login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Indices of the primes that have the same base-10 digits as the corresponding prime number (with multiplicity), disregarding zero digits.
3

%I #29 Jul 07 2022 08:03:33

%S 751,2971,5174,5594,5789,6106,6151,6376,6613,7129,12376,23719,24758,

%T 47135,53146,73906,73969,74956,96512,111406,114475,119825,126896,

%U 128377,131657,135815,135817,137681,152402,158924,182045,192641,197269,203383,203758,215809,218332,230261,230431,232946,233485,235918

%N Indices of the primes that have the same base-10 digits as the corresponding prime number (with multiplicity), disregarding zero digits.

%e 976571 is a term since prime(976571) = 15097067 has the same multiset of nonzero digits {1,5,6,7,7,9} as its index 976571.

%t a[max_] := Module[{l}, Select[{#, Prime[#]} & /@ Range[max], (l = IntegerDigits[#[[2]]]; SortBy[Tally[l], First] === SortBy[Tally[PadLeft[IntegerDigits[#[[1]]], Length[l]]], First]) &]]; a[10^6][[All, 1]] (* Gives the first 108 terms *)

%o (Python)

%o from sympy import nextprime

%o from itertools import islice

%o def b10s(n): return "".join(sorted(str(n))).lstrip("0")

%o def agen():

%o k, pk = 1, 2

%o while True:

%o if b10s(k) == b10s(pk): yield k

%o k, pk = k+1, nextprime(pk)

%o print(list(islice(agen(), 32))) # _Michael S. Branicky_, Jun 28 2022

%o (PARI) strip0(v) = {my(nn=1); while(v[nn]==0, nn++); v[nn..#v]};

%o a355318(upto) = {my(k=0); forprime (p=2, upto, k++; if(strip0(vecsort(digits(k))) == strip0(vecsort(digits(p))), print1(k,", ")))};

%o a355318(4000000); \\ _Hugo Pfoertner_, Jul 05 2022

%Y Cf. A355317 (the corresponding primes), A355539.

%K base,easy,nonn

%O 1,1

%A _Xiaofeng Wang_, Jun 28 2022