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.

A076623 Total number of left truncatable primes (without zeros) in base n.

This page as a plain text file.
%I A076623 #37 Apr 28 2022 13:39:09
%S A076623 0,3,16,15,454,22,446,108,4260,75,170053,100,34393,9357,27982,362,
%T A076623 14979714,685,3062899,59131,1599447,1372,1052029701,10484,7028048,
%U A076623 98336,69058060,3926
%N A076623 Total number of left truncatable primes (without zeros) in base n.
%C A076623 Approximation of a(b) by (PARI) code: l(b)=c=b*(b-1)/log(b)/eulerphi(b);\ return(floor((primepi(b)-omega(b))*exp(c)/c)); - _Robert Gerbicz_, Nov 02 2008
%C A076623 a(24) = 1052029701 based on strong BPSW pseudoprimes. Other terms up to a(29) use proved primes. - _Martin Fuller_, Nov 24 2008
%H A076623 I. O. Angell and H. J. Godwin, <a href="http://dx.doi.org/10.1090/S0025-5718-1977-0427213-2">On Truncatable Primes</a>, Math. Comput. 31, 265-267, 1977.
%H A076623 Michael S. Branicky, <a href="/A076623/a076623.py.txt">String-based Python Program</a>
%H A076623 Martin Fuller, <a href="/A076623/a076623_1.txt">Table of n, a(n) for n= 2..53</a>, with question marks where unknown
%H A076623 Hans Havermann, <a href="http://chesswanks.com/num/LTPs/">A076623 Decomposed</a>
%H A076623 <a href="/index/Tri#tprime">Index entries for sequences related to truncatable primes</a>
%p A076623 Lton := proc(L,b) add( op(i,L)*b^(i-1),i=1..nops(L)) ; end proc:
%p A076623 A076623rec := proc(L,b) local a,d,Lext,p ; a := 0 ; for d from 1 to b-1 do Lext := [op(L),d] ; p := Lton(Lext,b) ; if isprime(p) then a := a+1 ;  a := a+procname(Lext,b) ; end if; end do: a ;end proc:
%p A076623 A076623 := proc(b) A076623rec([],b) ; end proc:
%p A076623 for b from 2 do print(b,A076623(b)) ; end do: # _R. J. Mathar_, Jun 01 2011
%o A076623 (PARI)
%o A076623 f(b)=ct=0;A=[0];n=-1;L=1;while(L,n++;B=vector(L*b);M=0;\
%o A076623 for(i=1,L,for(j=1,b-1,x=A[i]+j*b^n;if(isprime[x],M++;B[M]=x;ct++)));\
%o A076623 L=M;A=vector(L,i,B[i]));return(ct) \\ _Robert Gerbicz_, Oct 31 2008
%o A076623 (Python) # works for all n; link has faster string-based version for n < 37
%o A076623 from sympy import isprime, primerange
%o A076623 from sympy.ntheory.digits import digits
%o A076623 def fromdigits(digs, base):
%o A076623     return sum(d*base**i for i, d in enumerate(digs))
%o A076623 def a(n):
%o A076623     prime_lists, an = [(p,) for p in primerange(1, n)], 0
%o A076623     while len(prime_lists) > 0:
%o A076623         an += len(prime_lists)
%o A076623         candidates = set(p+(d,) for p in prime_lists for d in range(1, n))
%o A076623         prime_lists = [c for c in candidates if isprime(fromdigits(c, n))]
%o A076623     return an
%o A076623 print([a(n) for n in range(2, 12)]) # _Michael S. Branicky_, Apr 27 2022
%Y A076623 Cf. A024779, A024780, A024781, A024782, A024783, A024784, A024785, A076586, A103443, A103463.
%K A076623 nonn,base,more
%O A076623 2,2
%A A076623 _Martin Renner_, Oct 22 2002, Nov 03 2002, Sep 24 2007, Feb 20 2008, Apr 20 2008
%E A076623 a(12) corrected from 170051 to 170053 by _Martin Fuller_, Oct 31 2008
%E A076623 a(18) corrected by _Robert Gerbicz_, Nov 02 2008
%E A076623 a(24)-a(29) from _Martin Fuller_, Nov 24 2008
%E A076623 Entries in a-file corrected by _N. J. A. Sloane_, Jun 02 2011