YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -2,14 +2,12 @@ func happy(n) is cached {
|
|||
static seen = Hash()
|
||||
|
||||
return true if n.is_one
|
||||
return false if seen.has_key(n)
|
||||
return false if seen.exists(n)
|
||||
|
||||
seen{n} = 1
|
||||
happy(n.digits »**» 2 -> sum)
|
||||
happy(n.digits.sum { _*_ })
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
Inf.times { |i|
|
||||
happy(i) ? say i : next
|
||||
++count == 8 && break
|
||||
say 8.defs {|i|
|
||||
happy(i) ? i : nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue