A361640 a(0) = 0, a(1) = 1; thereafter let b be the least power of 2 that does not appear in the binary expansions of a(n-2) and a(n-1), then a(n) is the smallest multiple of b that is not yet in the sequence.
0, 1, 2, 4, 3, 8, 12, 5, 6, 16, 7, 24, 32, 9, 10, 20, 11, 64, 28, 13, 14, 48, 15, 128, 80, 17, 18, 36, 19, 40, 44, 21, 22, 56, 23, 192, 72, 25, 26, 52, 27, 256, 60, 29, 30, 96, 31, 384, 160, 33, 34, 68, 35, 88, 76, 37, 38, 104, 39, 112, 120, 41, 42, 84, 43
Offset: 0
Examples
The first terms, in decimal and in binary, alongside the corresponding b's, are: n a(n) bin(a(n)) b -- ---- --------- --- 0 0 0 N/A 1 1 1 N/A 2 2 10 2 3 4 100 4 4 3 11 1 5 8 1000 8 6 12 1100 4 7 5 101 1 8 6 110 2 9 16 10000 8 10 7 111 1 11 24 11000 8 12 32 100000 32
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..8192
- Rémy Sigrist, PARI program
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^20.
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^14, showing primes in red, composite prime powers in gold, squarefree composites in green, and numbers neither squarefree nor prime powers in blue.
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Mathematica
nn = 120; c[] = False; q[] = 1; f[n_] := f[n] = -1 + Position[Reverse@ IntegerDigits[n, 2], 1][[All, 1]]; a[1] = 0; a[2] = 1; c[0] = c[1] = True; i = f[0]; j = f[1]; Do[(k = q[#]; While[c[k #], k++]; q[#] = k; k *= #) &[ 2^First@ Complement[Range[0, Max[#] + 1], #] &[Union[i, j]]]; Set[{a[n], c[k], i, j}, {k, True, j, f[k]}], {n, 3, nn}]; Array[a, nn] (* Michael De Vlieger, Mar 20 2023 *)
-
PARI
See Links section.
Comments