RosettaCodeData/Task/Happy-numbers/SETL/happy-numbers-1.setl
2023-07-01 13:44:08 -04:00

10 lines
187 B
Text

proc is_happy(n);
s := [n];
while n > 1 loop
if (n := +/[val(i)**2: i in str(n)]) in s then
return false;
end if;
s with:= n;
end while;
return true;
end proc;