A050141 a(n) = 2*floor((n+1)*phi) - 2*floor(n*phi) - 1 where phi = (1 + sqrt(5))/2 is the golden ratio.
3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 1, 3
Offset: 1
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
#[[2]]-#[[1]]-1&/@Partition[Table[2*Floor[n*GoldenRatio],{n,100}],2,1] (* Harvey P. Dale, Mar 09 2025 *)
-
PARI
a(n)=(n+1+sqrtint(5*(n+1)^2))\2*2 - (n+sqrtint(5*n^2))\2*2 - 1 \\ Charles R Greathouse IV, Dec 28 2017
-
Python
from math import isqrt def A050141(n): return -(n+isqrt(m:=5*n**2)&-2)+(n+1+isqrt(m+5*((n<<1)+1))&-2)-1 # Chai Wah Wu, May 04 2025
Extensions
Name edited by Michel Marcus and Charles R Greathouse IV, Dec 28 2017
Comments