OFFSET
1,1
LINKS
EXAMPLE
MAPLE
g:= n -> convert(convert(n, base, 2), `+`):
f:= proc(n) option remember; local t, S, d, L, B, forbid, i, j, r, q;
if n::even then return procname(n/2^padic:-ordp(n, 2)) fi;
L:= convert(n, base, 2);
t:= convert(L, `+`);
B:= select(t -> L[t]=1, [$1..nops(L)]);
forbid:= {seq(seq(B[i]-B[j], j=1..i-1), i=1..nops(B))};
S[0]:= [1];
for d from 1 do
S[d]:= NULL;
for j from 0 to d-1 do
if member(d-j, forbid) then next fi;
for r in S[j] do
q:= r + 2^d;
if g(q*n) = t*g(q) then
if isprime(q) then return q fi;
S[d]:= S[d], q;
fi
od
od;
S[d]:= [S[d]];
od
end proc:
map(f, [$1..100]);
PROG
(PARI) a(n) = my(p=3, h=hammingweight(n)); while (hammingweight(n*p) != h*hammingweight(p), p = nextprime(p+1)); p; \\ Michel Marcus, Sep 08 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Sep 07 2023
STATUS
approved