OFFSET
1,1
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(Python)
from sympy import nextprime
from itertools import islice
def b10s(n): return "".join(sorted(str(n))).lstrip("0")
def agen():
k, pk = 1, 2
while True:
if b10s(k) == b10s(pk): yield k
k, pk = k+1, nextprime(pk)
print(list(islice(agen(), 32))) # Michael S. Branicky, Jun 28 2022
(PARI) strip0(v) = {my(nn=1); while(v[nn]==0, nn++); v[nn..#v]};
a355318(upto) = {my(k=0); forprime (p=2, upto, k++; if(strip0(vecsort(digits(k))) == strip0(vecsort(digits(p))), print1(k, ", ")))};
a355318(4000000); \\ Hugo Pfoertner, Jul 05 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Xiaofeng Wang, Jun 28 2022
STATUS
approved