Math problem (Sample Programs)

by lrcvs, Monday, April 21, 2014, 16:20 (1165 days ago)

Find all positive integers
are greater unity
that the sum of the squares of its digits.


::::::::::::::::::::::::::::::::::::

for n = 1 to 1000000
if n - ((float(left(string(n),1))^2) + (float(right(string(n),1))^2)) = 1 then print n
next n

:::::::::::::::::::::::::::::::::::

Numbers = 35 y 75

Number: 35
35 = 3 y 5
3^2 = 9
5^2 = 25
25 +9 = 34
35-34 = 1

Number: 75
75 = 7 y 5
7^2 = 49
5 ^2 = 25
49 + 25 = 74
75 -74 = 1


Regards!


Complete thread:

 RSS Feed of thread

powered by my little forum