login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A265113 Primes p such that p and p^2 have the same number of 1's in their binary representations. 1

%I #17 Sep 08 2022 08:46:14

%S 2,3,7,31,79,127,157,317,379,751,1087,1151,1277,1279,1531,1789,1951,

%T 2297,2557,2927,3067,3259,3319,3581,4253,4349,5119,5231,5503,5807,

%U 5821,6271,6653,6871,8191,8447,8689,9209,10079,10837,11597,11903,12799,13309,13591

%N Primes p such that p and p^2 have the same number of 1's in their binary representations.

%C Primes p such that p^2 is in A089042.

%C Primes p such that A000120(p) = A000120(p^2).

%C Contains all terms > 43 in A079361.

%C Subset of A077436.

%H Robert Israel, <a href="/A265113/b265113.txt">Table of n, a(n) for n = 1..1000</a>

%e 7 is in the sequence because 7 and 7^2 = 49 have binary representations 111 and 110001 which both have three 1's.

%p f:= proc(n) isprime(n) and (convert(convert(n,base,2),`+`) = convert(convert(n^2,base,2),`+`)) end proc:

%p select(f, [2,seq(i,i=3..10^5,2)]);

%t Select[ Prime@ Range@ 1700, DigitCount[n, 2, 1] == DigitCount[n^2, 2, 1], &] (* _Robert G. Wilson v_, Dec 01 2015 *)

%o (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

%o (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)}

%o forprime(p=2, 1e5, if(c(p, 1, 2) == c(p^2, 1, 2), print1(p, ", "))) \\ _Altug Alkan_, Dec 02 2015

%Y Cf. A000120, A077436, A079361, A089042.

%K nonn,base

%O 1,1

%A _Robert Israel_, Dec 01 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 11:21 EDT 2024. Contains 371913 sequences. (Running on oeis4.)