Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,7 @@
hpy: {x@&1={~|/x=1 4}{_+/_sqr 0$'$x}//:x}
hpy 1+!100
1 7 10 13 19 23 28 31 32 44 49 68 70 79 82 86 91 94 97 100
8#hpy 1+!100
1 7 10 13 19 23 28 31

View file

@ -0,0 +1,8 @@
/ happynum.k
/ sum of squares of digits of an integer
dgtsmsqr: {d::(); (0<){d::d,x!10; x%:10}/x; +/d*d}
/ Test if an integer is a Happy number
isHappy: {s::(); while[1<x;a:(dgtsmsqr x); :[(a _in s); :0; s::s,a]; x:a];:1} / Returns 1 if Happy
/ Generate first x Happy numbers and display the list
hnum: {[x]; h::();i:1;while[(#h)<x; :[(isHappy i); h::(h,i)]; i+:1]; `0: ,"List of ", ($x), " Happy Numbers"; h}