OFFSET
1,1
COMMENTS
If N is a term then all numbers with the same digits as N are terms too.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
91 is a term because arranging its digits in ascending order yields 19, which is a prime.
MATHEMATICA
Select[Range[500], Mod[#, 10] != 0 && PrimeQ[FromDigits[Sort[IntegerDigits[#]]]] &]
PROG
(Python)
from sympy import isprime
def ok(n): return n%10 and isprime(int("".join(sorted(str(n)))))
print([k for k in range(260) if ok(k)]) # Michael S. Branicky, Apr 01 2024
(Python)
from itertools import count, islice, combinations_with_replacement
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations
def A371654_gen(): # generator of terms
for l in count(1):
xlist = []
for p in combinations_with_replacement('0123456789', l):
if isprime(int(''.join(p))):
xlist.extend(int(''.join(d)) for d in multiset_permutations(p) if d[0] != '0' and d[-1] != '0')
yield from sorted(xlist)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
César Eliud Lozada, Apr 01 2024
STATUS
approved