login
A370727
Lexicographically earliest sequence of distinct positive integers such that for any n > 0, prime(n) AND a(n) = a(n) (where prime(n) denotes the n-th prime number and AND denotes the bitwise AND operator).
2
2, 1, 4, 3, 8, 5, 16, 17, 6, 9, 7, 32, 33, 10, 11, 20, 18, 12, 64, 65, 72, 13, 19, 24, 96, 36, 34, 35, 37, 48, 14, 128, 129, 130, 21, 22, 25, 131, 38, 40, 49, 52, 15, 192, 68, 66, 67, 23, 97, 69, 41, 39, 80, 26, 256, 257, 260, 258, 261, 264, 27, 288, 50, 51
OFFSET
1,1
COMMENTS
In other words, the 1's in the binary expansion of the n-th term also appear in that of the n-th prime number.
This sequence is a permutation of the positive integers with inverse A370727: for any w > 0, there are infinitely many prime numbers whose binary expansions end with w 1's, and these are all occasions for an integer < 2^w to appear in the sequence.
EXAMPLE
The first terms, alongside the corresponding binary expansions, are:
n a(n) bin(a(n)) bin(prime(n))
-- ---- --------- -------------
1 2 10 10
2 1 1 11
3 4 100 101
4 3 11 111
5 8 1000 1011
6 5 101 1101
7 16 10000 10001
8 17 10001 10011
9 6 110 10111
10 9 1001 11101
PROG
(PARI) See Links section.
CROSSREFS
Cf. A295609, A295989, A370728 (inverse).
Sequence in context: A275902 A008347 A112387 * A193174 A126084 A294022
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 28 2024
STATUS
approved