Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
15
Task/Happy-numbers/Sidef/happy-numbers.sidef
Normal file
15
Task/Happy-numbers/Sidef/happy-numbers.sidef
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
func happy(n) is cached {
|
||||
static seen = Hash()
|
||||
|
||||
return true if n.is_one
|
||||
return false if seen.has_key(n)
|
||||
|
||||
seen{n} = 1
|
||||
happy(n.digits »**» 2 -> sum)
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
Inf.times { |i|
|
||||
happy(i) ? say i : next
|
||||
++count == 8 && break
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue