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.

A343834 Primes with digits in nondecreasing order, only primes, and with sum of digits also a prime.

This page as a plain text file.
%I A343834 #20 Jun 02 2021 02:21:26
%S A343834 2,3,5,7,23,223,227,337,557,577,2333,2357,2377,2557,2777,33377,222337,
%T A343834 222557,233357,233777,235577,2222333,2233337,2235557,3337777,3355777,
%U A343834 5555777,22222223,22233577,23333357,23377777,25577777,222222227,222222557,222222577
%N A343834 Primes with digits in nondecreasing order, only primes, and with sum of digits also a prime.
%C A343834 Intersection of A028864 and A062088.
%H A343834 Michael S. Branicky, <a href="/A343834/b343834.txt">Table of n, a(n) for n = 1..10000</a>
%t A343834 a[p_] := With[{dg = IntegerDigits@p}, PrimeQ@p && OrderedQ@dg && AllTrue[dg, PrimeQ] && PrimeQ@ Total@dg]; Cases[ Range[3*10^7], _?(a@# &)] (* or *)
%t A343834 upToDigitLen[k_] := Cases[ FromDigits@# & /@ Select[ Flatten[ Table[ Tuples[{2, 3, 5, 7}, {i}], {i, k}], 1], OrderedQ[#] &], _?(PrimeQ@# && PrimeQ@ Total@ IntegerDigits@# &)]; upToDigitLen[10]
%o A343834 (Python)
%o A343834 from sympy import isprime
%o A343834 from sympy.utilities.iterables import multiset_combinations
%o A343834 def aupton(terms):
%o A343834   n, digits, alst = 0, 1, []
%o A343834   while len(alst) < terms:
%o A343834     mcstr = "".join(d*digits for d in "2357")
%o A343834     for mc in multiset_combinations(mcstr, digits):
%o A343834       sd = sum(int(d) for d in mc)
%o A343834       if not isprime(sd): continue
%o A343834       t = int("".join(mc))
%o A343834       if isprime(t): alst.append(t)
%o A343834       if len(alst) == terms: break
%o A343834     else: digits += 1
%o A343834   return alst
%o A343834 print(aupton(35)) # _Michael S. Branicky_, May 01 2021
%Y A343834 Cf. A019546, A028864, A046704, A062088.
%K A343834 nonn,base,easy
%O A343834 1,1
%A A343834 _Mikk Heidemaa_, May 01 2021
%E A343834 a(33) and beyond from _Michael S. Branicky_, May 01 2021