cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A348295 a(n) = Sum_{k=1..n} (-1)^(floor(k*(sqrt(2)-1))).

Original entry on oeis.org

0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 3, 4, 5, 4
Offset: 0

Views

Author

Jianing Song, Oct 10 2021

Keywords

Comments

Problem B6 of the 81st William Powell Putnam Mathematical Competition (2020) asks to show that a(n) >= 0 for all n.
Conjecture: (1) Sequence is unbounded from above. Moreover, it seems that the earliest occurrence of m is A000129(m) for even m and A001333(m) for odd m (this has been confirmed for m <= 32 by Chai Wah Wu, Oct 21 2021). See A084068 for the conjectured indices of records.
(2) There are infinitely many 0's in the sequence. See A348299 for indices of 0. Since |a(n+1) - a(n)| = 1, (1)(2) together imply that this sequence hits every natural number infinitely many times.

Examples

			A097508(1)..A097508(10) = [0, 0, 1, 1, 2, 2, 2, 3, 3, 4], so a(10) = 1+1-1-1+1+1+1-1-1+1 = 2.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[(-1)^Floor[k*(Sqrt[2] - 1)], {k, 1, n}]; Array[a, 100, 0] (* Amiram Eldar, Oct 11 2021 *)
  • PARI
    a(n) = sum(k=1, n, (-1)^(sqrtint(2*k^2)-k))
    
  • Python
    from math import isqrt
    def A348295(n): return sum(-1 if (isqrt(2*k*k)-k) % 2 else 1 for k in range(1,n+1)) # Chai Wah Wu, Oct 12 2021

Formula

a(n) = Sum_{k=1..n} (-1)^A097508(k).