Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
// Look and Say Sequence
|
||||
repeats = function(digit, string)
|
||||
count = 0
|
||||
for c in string
|
||||
if c != digit then break
|
||||
count = count + 1
|
||||
end for
|
||||
return str(count)
|
||||
end function
|
||||
|
||||
numbers = "1"
|
||||
print numbers
|
||||
for i in range(1,10) // warning, loop size > 15 gets long numbers very quickly
|
||||
number = ""
|
||||
position = 0
|
||||
while position < numbers.len
|
||||
repeatCount = repeats(numbers[position], numbers[position:])
|
||||
number = number + repeatCount + numbers[position]
|
||||
position = position + repeatCount.val
|
||||
end while
|
||||
print number
|
||||
numbers = number
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue