Kaprekar numbers: Difference between revisions
Content added Content deleted
(added Factor) |
m (→{{header|REXX}}: adjust for special case of unity for the upper limit.) |
||
Line 3,812: | Line 3,812: | ||
Kaprekar: procedure; parse arg N; #=0; aN=abs(N) /*set counter to zero; use │N│ value.*/ |
Kaprekar: procedure; parse arg N; #=0; aN=abs(N) /*set counter to zero; use │N│ value.*/ |
||
numeric digits max(9, 2*length(N) ) /*use enough decimal digits for square.*/ |
numeric digits max(9, 2*length(N) ) /*use enough decimal digits for square.*/ |
||
if aN> |
if aN>0 then call tell 1 /*unity is defined to be a Kaprekar #. */ |
||
/* [↑] handle case of N being unity.*/ |
/* [↑] handle case of N being unity.*/ |
||
if aN>1 then do j=2 for aN-2; s=j*j /*calculate the square of J (S). */ |
if aN>1 then do j=2 for aN-2; s=j*j /*calculate the square of J (S). */ |