The algorithm finds the members of some class of interesting or magic numbers. I suspect the purpose for performing the calculation was to exercise the CPU.
But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)