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.

A387305 Least k such that the Hamming weight (A000120) of n*k is prime.

This page as a plain text file.
%I A387305 #46 Sep 02 2025 09:24:30
%S A387305 3,3,1,3,1,1,1,3,1,1,1,1,1,1,19,3,1,1,1,1,1,1,3,1,1,1,3,1,3,19,1,3,1,
%T A387305 1,1,1,1,1,3,1,1,1,3,1,9,3,1,1,1,1,7,1,5,3,1,1,3,3,1,19,1,1,67,3,1,1,
%U A387305 1,1,1,1,3,1,1,1,5,1,5,3,1,1,1,1,5,1,5,3
%N A387305 Least k such that the Hamming weight (A000120) of n*k is prime.
%C A387305 a(n) is always odd.
%H A387305 Pablo Cadena-UrzĂșa, <a href="/A387305/b387305.txt">Table of n, a(n) for n = 1..10000</a>
%F A387305 a(n) = min{k >= 1 : A000120(n*k) is prime}.
%F A387305 a(n) = 1 if A000120(n) is prime (see A052294).
%F A387305 For all m >= 0, a(2^m) = 3.
%e A387305 a(1) = 3 because A000120(1) = 1 (not prime), A000120(2) = 1, and A000120(3) = 2 (prime).
%e A387305 a(11) = 1 because A000120(11) = 3 (prime).
%e A387305 a(15) = 19 since 15*19 = 285 and A000120(285) = 5 (prime); for 1 <= k < 19 the value A000120(15*k) is not prime.
%t A387305 A387305[n_] := Module[{k = -1}, While[!PrimeQ[DigitSum[(k += 2)*n, 2]]]; k];
%t A387305 Array[A387305, 100] (* _Paolo Xausa_, Sep 02 2025 *)
%o A387305 (PARI) a(n) = {my(k=1); while(!isprime(hammingweight(n*k)), k++); k};
%o A387305 vector(100, n, a(n))  \\ first 100 terms
%o A387305 (Python)
%o A387305 import sympy as sp
%o A387305 def a(n, kmax=10**6):
%o A387305     for k in range(1, kmax + 1):
%o A387305         if sp.isprime((n*k).bit_count()):
%o A387305             return k
%o A387305     return None
%o A387305 def A(N):
%o A387305     return [a(n) for n in range(1, N + 1)]
%Y A387305 Cf. A000120, A052294.
%K A387305 nonn,base,new
%O A387305 1,1
%A A387305 _Pablo Cadena-UrzĂșa_, Aug 25 2025