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.

A352452 2^k appears in the binary expansion of a(n) iff 2^k appears in the binary expansion of n and k+1 does not divide n.

Original entry on oeis.org

0, 0, 0, 2, 4, 4, 0, 6, 0, 8, 8, 10, 0, 12, 12, 10, 16, 16, 16, 18, 4, 16, 20, 22, 16, 8, 24, 26, 20, 28, 8, 30, 32, 32, 32, 34, 0, 36, 36, 34, 32, 40, 8, 42, 36, 40, 44, 46, 16, 48, 32, 50, 52, 52, 16, 38, 48, 56, 56, 58, 0, 60, 60, 58, 64, 64, 64, 66, 68, 64
Offset: 0

Views

Author

Rémy Sigrist, Mar 16 2022

Keywords

Comments

The idea is to keep the 1's in the binary expansion of a number whose positions are related in some way to that number.

Examples

			For n = 42:
- 42 = 2^5 + 2^3 + 2^1,
- 5+1 divides 42,
- 3+1 does not divide 42,
- 1+1 divides 42,
- so a(42) = 2^3 = 8.
		

Crossrefs

See A352449, A352450, A352451, A352458 for similar sequences.

Programs

  • PARI
    a(n) = { my (v=0, m=n, k); while (m, m-=2^k=valuation(m,2); if (n%(k+1), v+=2^k)); v }

Formula

a(n) <= n.