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.

A384688 Runs of t in the range 0 <= t <= k and the same parity as k, for successive k >= 0.

Original entry on oeis.org

0, 1, 0, 2, 1, 3, 0, 2, 4, 1, 3, 5, 0, 2, 4, 6, 1, 3, 5, 7, 0, 2, 4, 6, 8, 1, 3, 5, 7, 9, 0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11, 0, 2, 4, 6, 8, 10, 12, 1, 3, 5, 7, 9, 11, 13, 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16
Offset: 0

Views

Author

Kevin Ryde, Jun 07 2025

Keywords

Comments

The corresponding k is A055086(n), or k+1 = A000267(n).
A run is 0, 2, 4, ..., k when k even, or 1, 3, 5, ..., k when k odd, and has length floor(k/2) + 1.
Runs start at quarter squares n = A002620(k+1), with those beginning 0 at oblong numbers n = A002378(i) and those starting 1 at the squares n = (i+1)^2 (for i >= 0 in both cases).
Starts to differ from A025643 at n=109.

Examples

			Runs and their corresponding k = A055086(n) begin,
  n          = 0  1  2    4    6      9
  a(n)       = 0, 1, 0,2, 1,3, 0,2,4, 1,3,5, ...
  A055086(n) = 0, 1, 2,2, 3,3, 4,4,4, 5,5,5, ...
		

Crossrefs

Cf. A002620, A002378 (indices of 0's), A000290 (indices of 1's).

Programs

  • Mathematica
    ClearAll[a] a[n_Integer]:=Module[{s,r},s=Floor[Sqrt[n]]; r=n-s^2; If[rVincenzo Librandi, Jul 06 2025 *)
  • PARI
    a(n) = my(r,s=sqrtint(n,&r)); if(r
    				

Formula

a(n) = 2*r+1 if r < s or a(n) = 2*(r-s) otherwise, where square root and remainder n = s^2 + r being s=A000196(n), r=A053186(n).
a(n) = ceiling(A053186(4*n+1) / 2).
a(n) = A055086(n) - 2*A216607(n+1).
a(n) = 2*A055087(n) + A079813(n+1).