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.

A372475 Length of binary expansion (or number of bits) of the n-th squarefree number.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8
Offset: 1

Views

Author

Gus Wiseman, May 09 2024

Keywords

Examples

			The 10th squarefree number is 14, with binary expansion (1,1,1,0), so a(10) = 4.
		

Crossrefs

For prime instead of squarefree we have A035100, 1's A014499, 0's A035103.
Restriction of A070939 to A005117.
Run-lengths are A077643.
For weight instead of length we have A372433 (restrict A000120 to A005117).
For zeros instead of length we have A372472, firsts A372473.
Positions of first appearances are A372540.
A030190 gives binary expansion, reversed A030308.
A048793 lists positions of ones in reversed binary expansion, sum A029931.
A371571 lists positions of zeros in binary expansion, sum A359359.
A371572 lists positions of ones in binary expansion, sum A230877.
A372515 lists positions of zeros in reversed binary expansion, sum A359400.

Programs

  • Mathematica
    IntegerLength[Select[Range[1000],SquareFreeQ],2]
  • Python
    from math import isqrt
    from sympy import mobius
    def A372475(n):
        def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))
        m, k = n, f(n)
        while m != k:
            m, k = k, f(k)
        return int(m).bit_length() # Chai Wah Wu, Aug 02 2024

Formula

a(n) = A070939(A005117(n)).
a(n) = A372472(n) + A372433(n).