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.

A371653 Numbers k such that the number formed by putting the digits of k in descending order is prime.

This page as a plain text file.
%I A371653 #21 Apr 10 2024 20:28:21
%S A371653 2,3,5,7,11,13,14,16,17,31,34,35,37,38,41,43,53,61,71,73,79,83,97,112,
%T A371653 113,118,119,121,124,125,128,131,133,134,136,142,143,145,146,149,152,
%U A371653 154,157,163,164,166,167,175,176,179,181,182,188,191,194,197,199
%N A371653 Numbers k such that the number formed by putting the digits of k in descending order is prime.
%C A371653 Numbers k such that A004186(k) is prime. - _Robert Israel_, Apr 01 2024
%C A371653 If N is a term then all numbers with the same digits as N are terms too.
%H A371653 Robert Israel, <a href="/A371653/b371653.txt">Table of n, a(n) for n = 1..10000</a>
%e A371653 142 is a term because its digits in decreasing order form 421 and this is prime.
%p A371653 dd:= proc(n) local L,i;
%p A371653    L:= sort(convert(n,base,10));
%p A371653    add(L[i]*10^(i-1),i=1..nops(L))
%p A371653 end proc:
%p A371653 select(isprime @ dd, [$1..1000]); # _Robert Israel_, Apr 01 2024
%t A371653 Select[Range[500], PrimeQ[FromDigits[ReverseSort[IntegerDigits[#]]]] &]
%o A371653 (Python)
%o A371653 from sympy import isprime
%o A371653 def ok(n): return isprime(int("".join(sorted(str(n), reverse=True))))
%o A371653 print([k for k in range(200) if ok(k)]) # _Michael S. Branicky_, Apr 01 2024
%o A371653 (Python)
%o A371653 from itertools import count, islice, combinations_with_replacement
%o A371653 from sympy import isprime
%o A371653 from sympy.utilities.iterables import multiset_permutations
%o A371653 def A371653_gen(): # generator of terms
%o A371653     for l in count(1):
%o A371653         xlist = []
%o A371653         for p in combinations_with_replacement('987654321',l):
%o A371653             if isprime(int(''.join(p))):
%o A371653                 xlist.extend(int(''.join(d)) for d in multiset_permutations(p))
%o A371653         yield from sorted(xlist)
%o A371653 A371653_list = list(islice(A371653_gen(),30)) # _Chai Wah Wu_, Apr 10 2024
%Y A371653 Cf. A004186, A007500, A095179, A371654.
%K A371653 nonn,base,easy
%O A371653 1,1
%A A371653 _César Eliud Lozada_, Apr 01 2024