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!)
A371653 Numbers k such that the number formed by putting the digits of k in descending order is prime. 2
2, 3, 5, 7, 11, 13, 14, 16, 17, 31, 34, 35, 37, 38, 41, 43, 53, 61, 71, 73, 79, 83, 97, 112, 113, 118, 119, 121, 124, 125, 128, 131, 133, 134, 136, 142, 143, 145, 146, 149, 152, 154, 157, 163, 164, 166, 167, 175, 176, 179, 181, 182, 188, 191, 194, 197, 199 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Numbers k such that A004186(k) is prime. - Robert Israel, Apr 01 2024
If N is a term then all numbers with the same digits as N are terms too.
LINKS
EXAMPLE
142 is a term because its digits in decreasing order form 421 and this is prime.
MAPLE
dd:= proc(n) local L, i;
L:= sort(convert(n, base, 10));
add(L[i]*10^(i-1), i=1..nops(L))
end proc:
select(isprime @ dd, [$1..1000]); # Robert Israel, Apr 01 2024
MATHEMATICA
Select[Range[500], PrimeQ[FromDigits[ReverseSort[IntegerDigits[#]]]] &]
PROG
(Python)
from sympy import isprime
def ok(n): return isprime(int("".join(sorted(str(n), reverse=True))))
print([k for k in range(200) 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 A371653_gen(): # generator of terms
for l in count(1):
xlist = []
for p in combinations_with_replacement('987654321', l):
if isprime(int(''.join(p))):
xlist.extend(int(''.join(d)) for d in multiset_permutations(p))
yield from sorted(xlist)
A371653_list = list(islice(A371653_gen(), 30)) # Chai Wah Wu, Apr 10 2024
CROSSREFS
Sequence in context: A097312 A095179 A074895 * A298536 A331784 A325162
KEYWORD
nonn,base,easy
AUTHOR
César Eliud Lozada, Apr 01 2024
STATUS
approved

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 August 2 22:39 EDT 2024. Contains 374875 sequences. (Running on oeis4.)