Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #29 Oct 23 2024 14:40:14
%S 2,2,1,2,2,2,2,3,2,3,2,2,2,3,3,3,3,3,2,3,2,2,2,3,2,3,2,2,1,2,2,2,2,2,
%T 1,2,1,1,1,2,2,2,2,2,1,2,2,2,2,3,2,3,2,2,1,2,2,2,2,2,1,2,1,1,1,2,1,2,
%U 1,1,0,1,1,1,1,2,1,2,1,1,1,2,2,2,2,2,1,2,2,2,2,3,2,3,2,2,1,2,2
%N a(n) = 3+floor( Sum_{k=1..n} <((-1)^k)*k*(1+sqrt(5))/2> ), where < > = fractional part.
%C The first negative term is a(1291) = -1. - _Georg Fischer_, Feb 15 2019
%H G. C. Greubel, <a href="/A194822/b194822.txt">Table of n, a(n) for n = 1..10000</a>
%t r = GoldenRatio; p[x_] := FractionalPart[x];
%t f[n_] := 3 + Floor[Sum[p[k*r] (-1)^k, {k, 1, n}]]
%t Table[f[n], {n, 1, 100}] (* A194822 *)
%o (PARI) a(n) = 3 + floor(sum(k=1,n, (-1)^k*frac(k*(1+sqrt(5))/2))) \\ _G. C. Greubel_, Apr 02 2018
%o (Magma) [3 + Floor((&+[(-1)^k*(k*(1+Sqrt(5))/2 - Floor(k*(1+Sqrt(5))/2)) :k in [1..n]])) : n in [1..50]]; // _G. C. Greubel_, Apr 02 2018
%Y Cf. A001622, A194821, A194823, A194824.
%K sign
%O 1,1
%A _Clark Kimberling_, Sep 03 2011
%E Definition corrected by _Georg Fischer_, Jul 31 2023