login
A194821
a(n) = 1+floor(Sum_{k=1..n} <((-1)^k)*k*sqrt(2)>), where < > = fractional part.
4
0, 1, 1, 1, 1, 2, 1, 1, 0, 1, 0, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 2, 2, 1, 2, 1, 2, 2, 2, 2, 3, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 0, 1, 0, 1, 1, 1, 1, 2, 1, 1, 0, 1, 0, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 2, 2, 1, 2, 1, 2, 2, 2, 2, 3, 3
OFFSET
1,6
COMMENTS
Does 0 occur infinitely many times? Is the sequence unbounded?
LINKS
MATHEMATICA
r = Sqrt[2]; p[x_] := FractionalPart[x];
f[n_] := 1 + Floor[Sum[p[k*r] (-1)^k, {k, 1, n}]]
Table[f[n], {n, 1, 100}] (* A194821 *)
PROG
(PARI) a(n) = 1 + floor(sum(k=1, n, (-1)^k*frac(k*sqrt(2)))) \\ G. C. Greubel, Apr 02 2018
(Magma) [1 + Floor((&+[(-1)^k*(k*Sqrt(2) - Floor(k*Sqrt(2))) :k in [1..n]])) : n in [1..50]]; // G. C. Greubel, Apr 02 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Sep 03 2011
STATUS
approved