Hofstadter Figure-Figure sequences: Difference between revisions

CoffeeScript: bug fixed
(CoffeeScript version)
(CoffeeScript: bug fixed)
Line 510:
 
[1..10].map (i) -> console.log 'R(' + i + ') = ' + ffr(i)
int_array = ([1..40].map ffr).concat [1..960].map ffs
int_array.concat [1..960].map ffs
int_array.sort (a, b) -> a - b
 
i = 1
check = (i) ->
while i <= 1000
if int_array[i - 1] != i
throw 'Something\'s wrong!'
 
else
check i for i in [1..1000]
console.log '1000 integer check ok.'
console.log '1000 iinteger +=check 1ok.'</lang>
{{out}}
As JavaScript.
Anonymous user