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.

A337821 For n >= 0, a(4n+1) = 0, a(4n+3) = a(2n+1) + 1, a(2n+2) = a(n+1).

Original entry on oeis.org

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

Views

Author

Peter Munn, Sep 23 2020

Keywords

Comments

This sequence is the ruler sequence A007814 interleaved with this sequence; specifically, the odd bisection is A007814, the even bisection is the sequence itself.
The 3-adic valuation of the Doudna sequence (A005940).
The 2-adic valuation of Kimberling's paraphrase (A003602) of the binary number system. [Edited Peter Munn, Aug 13 2025.]

Examples

			Start of table showing the interleaving with ruler sequence, A007814:
   n  a(n)  A007814    a(n/2)
            ((n+1)/2)
   1   0       0
   2   0                 0
   3   1       1
   4   0                 0
   5   0       0
   6   1                 1
   7   2       2
   8   0                 0
   9   0       0
  10   0                 0
  11   1       1
  12   1                 1
  13   0       0
  14   2                 2
  15   3       3
  16   0                 0
  17   0       0
  18   0                 0
  19   1       1
  20   0                 0
  21   0       0
  22   1                 1
  23   2       2
  24   1                 1
		

Crossrefs

Odd bisection: A007814.
A000265, A003602, A005940, A007949 are used in a formula defining this sequence.
Positions of zeros: A091072.
Sequences with similar interleaving: A089309, A014577, A025480, A034947, A038189, A082392, A099545, A181363, A274139.

Programs

  • Mathematica
    a[n_] := IntegerExponent[(n/2^IntegerExponent[n, 2] + 1)/2, 2]; Array[a, 100] (* Amiram Eldar, Sep 30 2020 *)
  • PARI
    a(n) = valuation(n>>valuation(n,2)+1, 2) - 1; \\ Kevin Ryde, Apr 06 2024

Formula

a(2*n) = a(n).
a(2*n+1) = A007814(n+1).
a(n) = A007949(A005940(n)).
a(n) = A007814(A003602(n)) = A007814((A000265(n)+1) / 2) = A089309(n) - 1.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1. - Amiram Eldar, Sep 13 2024