Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Happy-numbers/Lasso/happy-numbers-1.lasso
Normal file
15
Task/Happy-numbers/Lasso/happy-numbers-1.lasso
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/lasso9
|
||||
|
||||
define isHappy(n::integer) => {
|
||||
local(past = set)
|
||||
while(#n != 1) => {
|
||||
#n = with i in string(#n)->values sum math_pow(integer(#i), 2)
|
||||
#past->contains(#n) ? return false | #past->insert(#n)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
with x in generateSeries(1, 500)
|
||||
where isHappy(#x)
|
||||
take 8
|
||||
select #x
|
||||
1
Task/Happy-numbers/Lasso/happy-numbers-2.lasso
Normal file
1
Task/Happy-numbers/Lasso/happy-numbers-2.lasso
Normal file
|
|
@ -0,0 +1 @@
|
|||
1, 7, 10, 13, 19, 23, 28, 31
|
||||
Loading…
Add table
Add a link
Reference in a new issue