Kaprekar numbers: Difference between revisions

m
→‎{{header|Maple}}: Move text outside of code section.
m (→‎{{header|REXX}}: incorporated userid Vbustos' (for Maple) idea of testing for a number modulus 9 being greater than 1 as a filter. This increased the speed by 28%.)
m (→‎{{header|Maple}}: Move text outside of code section.)
Line 3,019:
 
=={{header|Maple}}==
<lang Maple>
For a number x to be Kaprekar, it must have x^2 congruent to x mod 9.
Which is only achievable when x has remainder 1 or 0 mod 9. So we only check for these cases.
<lang Maple>
 
isKaprekar := proc(n::posint)
local holder, square, num_of_digits, k, left, right;
Anonymous user