OFFSET
1,1
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..1000
EXAMPLE
7 is in the sequence because 7 and 7^2 = 49 have binary representations 111 and 110001 which both have three 1's.
MAPLE
f:= proc(n) isprime(n) and (convert(convert(n, base, 2), `+`) = convert(convert(n^2, base, 2), `+`)) end proc:
select(f, [2, seq(i, i=3..10^5, 2)]);
MATHEMATICA
Select[ Prime@ Range@ 1700, DigitCount[n, 2, 1] == DigitCount[n^2, 2, 1], &] (* Robert G. Wilson v, Dec 01 2015 *)
PROG
(Magma) [NthPrime(n): n in [1..2000] | Multiplicity({* z: z in Intseq(NthPrime(n)^2, 2) *}, 1) eq &+Intseq(NthPrime(n), 2)]; // Vincenzo Librandi, Dec 02 2015
(PARI) c(k, d, b) = {my(c=0, f); while (k>b-1, f=k-b*(k\b); if (f==d, c++); k\=b); if (k==d, c++); return(c)}
forprime(p=2, 1e5, if(c(p, 1, 2) == c(p^2, 1, 2), print1(p, ", "))) \\ Altug Alkan, Dec 02 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Dec 01 2015
STATUS
approved