A190427 a(n) = [(b*n+c)*r] - b*[n*r] - [c*r], where (r,b,c)=(golden ratio,2,1) and []=floor.
1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 1, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 1, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 1, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2, 1, 1, 2, 1, 0, 2, 1, 2, 1, 0, 2, 1, 0, 1, 1, 2, 1, 0, 2, 1, 2
Offset: 1
Keywords
Examples
a(1)=[3r]-2[r]-1=4-3-1=1. a(2)=[5r]-2[2r]-1=8-6-1=1. a(3)=[7r]-2[3r]-1=11-8-1=2.
Links
- G. C. Greubel, Table of n, a(n) for n = 1..10000
Programs
-
Magma
[Floor((2*n+1)*(1+Sqrt(5))/2) - 2*Floor(n*(1+Sqrt(5))/2) - 1: n in [1..100]]; // G. C. Greubel, Apr 06 2018
-
Mathematica
r = GoldenRatio; b = 2; c = 1; f[n_] := Floor[(b*n + c)*r] - b*Floor[n*r] - Floor[c*r]; t = Table[f[n], {n, 1, 320}] (* A190427 *) Flatten[Position[t, 0]] (* A190428 *) Flatten[Position[t, 1]] (* A190429 *) Flatten[Position[t, 2]] (* A190430 *) Table[Floor[(2*n+1)*GoldenRatio] - 2*Floor[n*GoldenRatio] -1, {n,1,100}] (* G. C. Greubel, Apr 06 2018 *)
-
PARI
for(n=1,100, print1(floor((2*n+1)*(1+sqrt(5))/2) - 2*floor(n*(1+sqrt(5))/2) - 1, ", ")) \\ G. C. Greubel, Apr 06 2018
-
Python
from mpmath import mp, phi from sympy import floor mp.dps=100 def a(n): return floor((2*n + 1)*phi) - 2*floor(n*phi) - 1 print([a(n) for n in range(1, 132)]) # Indranil Ghosh, Jul 02 2017
Formula
a(n) = [(2*n+1)*r] - 2*[n*r] - 1, where r=(1+sqrt(5))/2.
Comments