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.

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.

Original entry on oeis.org

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

Views

Author

David James Sycamore, Jan 31 2025

Keywords

Comments

Self inverse sequence with fixed points on powers of 2 (similar to A005940). Records subsequence (after 1,2) set by odd numbers with binary weight = 2 (see A000051, for n >= 2, and also A048578).
Conjectured to be a permutation of the natural numbers (primes not in order).

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).
		

Crossrefs

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.