A380739 For n = 2^k (k>=0), a(n) = n. Otherwise a(n) != n is the smallest number not yet in the sequence having the same binary weight as n and such that gcd(n,a(n)) > 1.
1, 2, 6, 4, 10, 3, 14, 8, 12, 5, 22, 9, 26, 7, 27, 16, 34, 20, 38, 18, 28, 11, 46, 33, 35, 13, 15, 21, 58, 39, 62, 32, 24, 17, 25, 40, 74, 19, 30, 36, 82, 44, 86, 42, 51, 23, 94, 66, 56, 52, 45, 50, 106, 57, 110, 49, 54, 29, 118, 75, 122, 31, 111, 64, 80, 48, 134
Offset: 1
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..16384
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^14.
Programs
-
Mathematica
nn = 120; c[_] := False; u = 1; f[x_] := f[x] = DigitCount[x, 2, 1]; Reap[Do[w = f[n]; k = u; If[w == 1, k = n, While[Or[c[k], CoprimeQ[k, n], w != f[k], k == n], 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; p a prime implies a(p) = 2*p.
Comments