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.

A371654 Numbers that are not multiples of 10 and that yield a prime if their digits are arranged in ascending order.

This page as a plain text file.
%I A371654 #22 Apr 26 2024 12:26:14
%S A371654 2,3,5,7,11,13,17,19,23,29,31,32,37,47,59,67,71,73,74,76,79,89,91,92,
%T A371654 95,97,98,101,103,107,109,113,127,131,137,139,149,157,167,172,173,175,
%U A371654 176,179,193,194,197,199,203,209,217,223,227,229,232,233,239,257
%N A371654 Numbers that are not multiples of 10 and that yield a prime if their digits are arranged in ascending order.
%C A371654 If N is a term then all numbers with the same digits as N are terms too.
%H A371654 Michael S. Branicky, <a href="/A371654/b371654.txt">Table of n, a(n) for n = 1..10000</a>
%e A371654 91 is a term because arranging its digits in ascending order yields 19, which is a prime.
%t A371654 Select[Range[500],  Mod[#, 10] != 0 && PrimeQ[FromDigits[Sort[IntegerDigits[#]]]] &]
%o A371654 (Python)
%o A371654 from sympy import isprime
%o A371654 def ok(n): return n%10 and isprime(int("".join(sorted(str(n)))))
%o A371654 print([k for k in range(260) if ok(k)]) # _Michael S. Branicky_, Apr 01 2024
%o A371654 (Python)
%o A371654 from itertools import count, islice, combinations_with_replacement
%o A371654 from sympy import isprime
%o A371654 from sympy.utilities.iterables import multiset_permutations
%o A371654 def A371654_gen(): # generator of terms
%o A371654     for l in count(1):
%o A371654         xlist = []
%o A371654         for p in combinations_with_replacement('0123456789',l):
%o A371654             if isprime(int(''.join(p))):
%o A371654                 xlist.extend(int(''.join(d)) for d in multiset_permutations(p) if d[0] != '0' and d[-1] != '0')
%o A371654         yield from sorted(xlist)
%o A371654 A371654_list = list(islice(A371654_gen(),20)) # _Chai Wah Wu_, Apr 10 2024
%Y A371654 Cf. A007500, A095179, A371653.
%K A371654 nonn,base,easy
%O A371654 1,1
%A A371654 _César Eliud Lozada_, Apr 01 2024