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
16
Task/Happy-numbers/Oforth/happy-numbers.oforth
Normal file
16
Task/Happy-numbers/Oforth/happy-numbers.oforth
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
: isHappy(n)
|
||||
| cycle |
|
||||
ListBuffer new ->cycle
|
||||
|
||||
while(n 1 <>) [
|
||||
cycle include(n) ifTrue: [ false return ]
|
||||
cycle add(n)
|
||||
0 n asString apply(#[ asDigit sq + ]) ->n
|
||||
]
|
||||
true ;
|
||||
|
||||
: happyNum(N)
|
||||
| numbers |
|
||||
ListBuffer new ->numbers
|
||||
1 while(numbers size N <>) [ dup isHappy ifTrue: [ dup numbers add ] 1+ ]
|
||||
numbers println ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue