RosettaCodeData/Task/Happy-numbers/Maple/happy-numbers-4.maple
2023-07-01 13:44:08 -04:00

13 lines
340 B
Text

Happy? := proc( n )
if n = 1 then
true
elif n = 4 then
false
else
local s := SumSqDigits( n );
while not ( s in { 1, 4 } ) do
s := SumSqDigits( s )
end do;
evalb( s = 1 )
end if
end proc: