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.

A383782 a(n) is the number of n-digit terms in A383781.

This page as a plain text file.
%I A383782 #22 May 19 2025 09:26:30
%S A383782 4,10,30,147,408,1823,4353,17690,38419,143219,284441,980166,1806038,
%T A383782 5813294,10037352,30426498,49595776,142437454,220519428,603013312,
%U A383782 890961094,2329755538
%N A383782 a(n) is the number of n-digit terms in A383781.
%C A383782 After the first two terms, the ratios between successive odd terms and the ratios between successive even terms are decreasing. - _Michael S. Branicky_, May 11 2025
%t A383782 Unprotect[CompositeQ]; CompositeQ[1]:=True; Protect[CompositeQ]; Q[n_]:=And[AllTrue[FromDigits/@Table[Take[IntegerDigits[n], -i], {i,IntegerLength[n],1,-2}], PrimeQ], AllTrue[FromDigits/@Table[Take[IntegerDigits[n], -i], {i,IntegerLength[ n]-1,1,-2}], CompositeQ]]; a[n_]:=Module[{p=Prime[PrimePi[10^(n-1)]+1], k=0}, While[10^(n-1)<=p<10^n-1, If[Q[p], k++]; p=NextPrime[p]]; k]; Array[a,7]
%o A383782 (Python)
%o A383782 from gmpy2 import is_prime, mpz
%o A383782 from itertools import count, islice
%o A383782 def agen():
%o A383782     olst, elst = [2, 3, 5, 7], [11, 19, 29, 31, 41, 59, 61, 71, 79, 89]
%o A383782     yield from (len(olst), len(elst))
%o A383782     for n in count(1):
%o A383782         olst2, elst2 = [], []
%o A383782         for o in olst:
%o A383782             o, base = o, 10**(2*n-1)
%o A383782             for i in range(10*base, 100*base, base):
%o A383782                 t = i + o
%o A383782                 t2 = int(str(t)[1:])
%o A383782                 if is_prime(t) and not is_prime(t2):
%o A383782                     olst2.append(t)
%o A383782         yield len(olst2)
%o A383782         for e in elst:
%o A383782             e, base = e, 10**(2*n)
%o A383782             for i in range(10*base, 100*base, base):
%o A383782                 t = i + e
%o A383782                 t2 = int(str(t)[1:])
%o A383782                 if is_prime(t) and not is_prime(t2):
%o A383782                     elst2.append(t)
%o A383782         yield len(elst2)
%o A383782         olst, elst = sorted(olst2), sorted(elst2)
%o A383782 print(list(islice(agen(), 12))) # _Michael S. Branicky_, May 11 2025
%Y A383782 Cf. A383781.
%K A383782 nonn,base,more
%O A383782 1,1
%A A383782 _Stefano Spezia_, May 09 2025
%E A383782 a(11)-a(19) from _Michael S. Branicky_, May 11 2025
%E A383782 a(20)-a(22) from _Michael S. Branicky_, May 19 2025