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.

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

Original entry on oeis.org

2, 3, 7, 31, 79, 127, 157, 317, 379, 751, 1087, 1151, 1277, 1279, 1531, 1789, 1951, 2297, 2557, 2927, 3067, 3259, 3319, 3581, 4253, 4349, 5119, 5231, 5503, 5807, 5821, 6271, 6653, 6871, 8191, 8447, 8689, 9209, 10079, 10837, 11597, 11903, 12799, 13309, 13591
Offset: 1

Views

Author

Robert Israel, Dec 01 2015

Keywords

Comments

Primes p such that p^2 is in A089042.
Primes p such that A000120(p) = A000120(p^2).
Contains all terms > 43 in A079361.
Subset of A077436.

Examples

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

Crossrefs

Programs

  • 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
    
  • 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 *)
  • 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