Advertisement
zvoulgaris

Pentabonacci Numbers

Dec 13th, 2019
2,465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Julia 0.17 KB | None | 0 0
  1. p5 = [0, 1, 1, 2, 4]
  2.  
  3. function pn(n::Int64)
  4.     z = Array{BigInt}(undef, n)
  5.     z[1:5] = p5
  6.  
  7.     for i = 6:n
  8.         z[i] = sum(z[i-5:i-1])
  9.     end
  10.  
  11.     return z
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement