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.

A337582 Numbers m such that m AND (m*2^k) is zero or a power of 2 for any k > 0 (where AND denotes the bitwise AND operator).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 22, 24, 25, 26, 32, 33, 34, 35, 36, 37, 38, 40, 41, 44, 48, 49, 50, 52, 64, 65, 66, 67, 68, 69, 70, 72, 74, 76, 80, 81, 82, 83, 88, 96, 97, 98, 100, 101, 104, 128, 129, 130, 131, 132, 133, 134, 136
Offset: 1

Views

Author

Rémy Sigrist, Sep 20 2020

Keywords

Comments

For any k > 0, there are A308251(k-1) positive terms with k binary digits.
The ones in the binary representation of any term encodes a finite set of nonnegative integers, say S, such that the differences between any two distinct elements of S are all unique.
For any m >= 0, m belongs to the sequence iff 2*m belongs to the sequence.

Examples

			Regarding 7:
- 7 AND 14 = 6, which is neither 0 nor a power of 2,
- so 7 does not belong to the sequence.
Regarding 13:
- we have the following values:
    k    13 AND (13*2^k)
    ---  ---------------
      1              2^3
      2              2^2
      3              2^3
    >=4                0
- so 13 belongs to the sequence.
		

Crossrefs

Cf. A308251.

Programs

  • PARI
    is(n) = { my (m=n); while (m>>=1, if (hammingweight(bitand(m,n))>1, return (0))); return (1) }