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.

A358268 a(n) is the least number k > 0 such that the binary weight of k^n is n times the binary weight of k.

Original entry on oeis.org

1, 21, 5, 21, 17, 17, 9, 113, 17, 49, 665, 37, 149, 17, 275, 163, 33, 41, 97, 67, 141, 67, 135, 197, 49, 267, 81, 81, 69, 779, 1163, 69, 325, 49, 587, 837, 281, 197, 293, 49, 147, 677, 67, 651, 647, 67, 793, 277, 353, 49, 1233, 1177, 165, 775, 721, 353, 817, 69, 647, 709, 209, 1233, 69, 67, 263
Offset: 1

Views

Author

Robert Israel, Nov 06 2022

Keywords

Comments

a(n) is the least number k > 0 such that A000120(k^n) = n*A000120(k).
All terms are odd.
Conjecture: lim_{n -> infinity} a(n) = infinity.

Examples

			a(3) = 5 because 5 = 101_2 and 5^3 = 1111101_2 so A000120(5) = 2, A000120(5^3) = 6 and 6 = 3*2.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k;
        for k from 1 by 2 do
          if convert(convert(k^n,base,2),`+`) = n*convert(convert(k,base,2),`+`) then return k
          fi
        od
    end proc:
    map(f, [$1..50]);
  • Mathematica
    a[n_] := Module[{k = 1}, While[Divide @@ DigitCount[k^{n, 1}, 2, 1] != n, k += 2]; k]; Array[a, 65] (* Amiram Eldar, Nov 07 2022 *)
  • PARI
    a(n) = my(k=1); while (hammingweight(k^n) != n*hammingweight(k), k++); k; \\ Michel Marcus, Nov 07 2022
  • Python
    def a(n):
        k = 1
        while bin(k**n).count("1") != n*bin(k).count("1"): k += 2
        return k
    print([a(n) for n in range(1, 66)]) # Michael S. Branicky, Nov 06 2022
    
  • Python
    from itertools import count
    def A358268(n): return next(filter(lambda k:k.bit_count()*n==(k**n).bit_count(),count(1,2))) # Chai Wah Wu, Nov 07 2022