A380728 For n a power of 2, a(n) = n. Otherwise a(n) is the smallest number not yet in the sequence which is coprime to n and has the same binary weight as n.
1, 2, 5, 4, 3, 17, 11, 8, 10, 9, 7, 65, 14, 13, 23, 16, 6, 257, 21, 33, 19, 25, 15, 1025, 22, 35, 29, 37, 27, 43, 47, 32, 20, 129, 26, 4097, 28, 41, 46, 513, 38, 67, 30, 49, 53, 39, 31, 16385, 44, 69, 58, 73, 45, 71, 59, 81, 77, 51, 55, 83, 62, 61, 95, 64, 12
Offset: 1
Examples
a(1) = 1, the smallest novel number coprime to 1 and having same binary weight (1) a(3) = 5, since weight(3) = weight(5) = 2 and gcd(2,5) = 1, and 5 is least such number. a(5) = 3 (sequence is self inverse).
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..16384
- Michael De Vlieger, Log log scatterplot of log_2(a(n)), n = 2..2^14.
Programs
-
Mathematica
nn = 2^13; c[_] := False; u = 1; f[x_] := f[x] = DigitCount[x, 2, 1]; Reap[Do[w = f[n]; Which[w == 1, k = n, And[w == 2, EvenQ[n]], k = 3; While[Or[c[k], ! CoprimeQ[k, n]], k = 2*(k - 1) + 1], True, k = u; While[Or[c[k], ! CoprimeQ[k, n], w != f[k]], k++] ]; Sow[k]; c[k] = True; If[k == u, While[c[u], u++]], {n, nn}] ][[-1, 1]] (* Michael De Vlieger, Feb 02 2025 *)
Formula
a(a(n)) = n for all n.
Extensions
More terms from Michael De Vlieger, Feb 02 2025.
Comments