Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
27
Task/Fusc-sequence/Pluto/fusc-sequence.pluto
Normal file
27
Task/Fusc-sequence/Pluto/fusc-sequence.pluto
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local fmt = require "fmt"
|
||||
|
||||
print("The first 61 numbers in the fusc sequence are:")
|
||||
local fusc = {0, 1}
|
||||
local fusc2 = {{0, 0}}
|
||||
local max_len = 1
|
||||
local n = 2
|
||||
while n < 20e6 do -- limit to indices under 20 million say
|
||||
local f = (n % 2 == 0) ? fusc[n/2 + 1] : fusc[(n - 1)/2 + 1] + fusc[(n+1)/2 + 1]
|
||||
fusc:insert(f)
|
||||
local len = #tostring(f)
|
||||
if len > max_len then
|
||||
max_len = len
|
||||
if n <= 60 then
|
||||
fusc2:insert({n, f})
|
||||
else
|
||||
fmt.print("%10s %s", fmt.int(n), fmt.int(f))
|
||||
end
|
||||
end
|
||||
if n == 60 then
|
||||
for fusc as e do io.write($"{e} ") end
|
||||
print("\n\nFirst terms longer than any previous ones for indices < 20,000,000:")
|
||||
print(" Index Value")
|
||||
for fusc2 as iv do fmt.print("%10d %d", iv[1], iv[2]) end
|
||||
end
|
||||
n += 1
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue