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.

Showing 1-10 of 56 results. Next

A173057 Partial sums of A024770.

Original entry on oeis.org

2, 5, 10, 17, 40, 69, 100, 137, 190, 249, 320, 393, 472, 705, 944, 1237, 1548, 1861, 2178, 2551, 2930, 3523, 4122, 4841, 5574, 6313, 7110, 9443, 11782, 14175, 16574, 19513, 22632, 25769, 29502, 33241, 37034, 40831, 46770, 53963, 61294, 68627
Offset: 1

Views

Author

Jonathan Vos Post, Feb 08 2010

Keywords

Comments

Partial sums of right-truncatable primes, primes whose every prefix is prime (in decimal representation). The sequence has 83 terms. The subsequence of prime partial sums of right-truncatable primes begins: 2, 5, 17, 137, 1237, 1861, 2551, 199483. What is the largest value in the subsubsequence of right-truncatable prime partial sums of right-truncatable primes?

Examples

			a(50) = 2 + 3 + 5 + 7 + 23 + 29 + 31 + 37 + 53 + 59 + 71 + 73 + 79 + 233 + 239 + 293 + 311 + 313 + 317 + 373 + 379 + 593 + 599 + 719 + 733 + 739 + 797 + 2333 + 2339 + 2393 + 2399 + 2939 + 3119 + 3137 + 3733 + 3739 + 3793 + 3797 + 5939 + 7193 + 7331 + 7333 + 7393 + 23333 + 23339 + 23399 + 23993 + 29399 + 31193 + 31379.
		

Crossrefs

A085823 Numbers in which all substrings are primes.

Original entry on oeis.org

2, 3, 5, 7, 23, 37, 53, 73, 373
Offset: 1

Views

Author

Zak Seidov, Jul 04 2003

Keywords

Comments

The definition implies that the number itself must be prime.
Apparently there are no such primes > 373.
From Jean-Marc Falcoz, Jan 11 2009: (Start)
This is correct.
There can't be any more terms, because they must necessarily be of the form
23737373733737... but the substring 237 is composite
or 273737373... but 273 is composite
or 5373737373... but 537 is composite
or 5737373737... but 573 is composite
or 37373737373... but 3737 is composite
or 7373737373... but 737 is composite
No other form is possible, otherwise, if the digit 2 or 5 is anywhere inside or at the end of the number, one substring-number is even or divisible by 5, and furthermore, there can't be twin digits, because one substring-number would then be divisible by 11.
Obviously, the digits 0, 1, 4, 6, 8, 9 can't appear anywhere in a term of the sequence. (End)
Subsequence of A024770 (right-truncatable primes), A068669 (noncomposite numbers in which all substrings are noncomposite). Supersequence of A202263 (primes in which all substrings and reversal substrings are primes). - Jaroslav Krizek, Jan 28 2012.
From Hieronymus Fischer, Apr 20 2012: (Start)
A more general definition is "Numbers such that all substrings of length <= 3 are primes". Proof: For numbers < 1000 this is plainly true. Suppose that there are such n >= 1000. We recognize that n must contain the string 373, as this is the only valid prime substring with the length 3. It follows, that there are substrings x37 or 73x, with any digit x. Evidently, neither x37 nor 73x are valid prime substrings, independent from the digit x. Thus, there is no number >= 1000 such that all substrings of length <= 3 are primes.
Also, numbers such that all substrings of length <= 2 are primes and the number of prime substrings of length = 3 is greater than m-3 for n <= 37373 and is greater than min(m-4,floor((m-1)/2) else; where m=floor(log_10(a(n)))+1 = number of digits. (End)

Examples

			Example : 373 is in the sequence, because 3, 7, 37, 73 and 373 are prime, but 733 is not in the sequence, because 33 is not prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range[10^3], AllTrue[FromDigits /@ Rest@ Subsequences@ IntegerDigits@ #, PrimeQ] &] (* Michael De Vlieger, Jul 30 2018 *)

Extensions

Thanks to Mark Underwood for pointing out misprints in the first version of this sequence.
Edited by N. J. A. Sloane, Jun 20 2009 at the suggestion of Lekraj Beedassy

A024785 Left-truncatable primes: every suffix is prime and no digits are zero.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97, 113, 137, 167, 173, 197, 223, 283, 313, 317, 337, 347, 353, 367, 373, 383, 397, 443, 467, 523, 547, 613, 617, 643, 647, 653, 673, 683, 743, 773, 797, 823, 853, 883, 937, 947, 953, 967, 983, 997, 1223
Offset: 1

Views

Author

Keywords

Comments

Last term is a(4260) = 357686312646216567629137 (Angell and Godwin). - Eric W. Weisstein, Dec 11 1999
Can be seen as table whose rows list n-digit terms, 1 <= n <= 25. Row lengths are A050987. - M. F. Hasler, Nov 07 2018

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.

Crossrefs

Supersequence of A240768.
Cf. A033664, A032437, A020994, A024770 (right-truncatable primes), A052023, A052024, A052025, A050986, A050987, A077390 (left-and-right truncatable primes), A137812 (left-or-right truncatable primes), A254753.

Programs

  • Haskell
    import Data.List (tails)
    a024785 n = a024785_list !! (n-1)
    a024785_list = filter (\x ->
       all (== 1) $ map (a010051 . read) $ init $ tails $ show x) a038618_list
    -- Reinhard Zumkeller, Nov 01 2011
    
  • Maple
    a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: for n from 1 to 3 do for k from 1 to 9 do for j from l1 to l2 do d:=[op(a[j]),k]: if(isprime(op(convert(d,base,10,10^nops(d)))))then a:=[op(a), d]: fi: od: od: l1:=l2+1: l2:=nops(a): if(l1>l2)then break: fi: od: seq(op(convert(a[j],base,10,10^nops(a[j]))),j=1..nops(a)); # Nathaniel Johnston, Jun 21 2011
    # second Maple program:
    T:= proc(n) option remember; `if`(n=0, "", sort(select(isprime,
          map(x-> seq(parse(cat(j, x)), j=1..9), [T(n-1)])))[])
        end:
    seq(T(n), n=1..4);  # Alois P. Heinz, Sep 01 2021
  • Mathematica
    max = 2000; truncate[p_] := If[id = IntegerDigits[p]; FreeQ[id, 0] && (Last[id] == 3 || Last[id] == 7) && PrimeQ[q = FromDigits[ Rest[id]]], q, p]; ok[n_] := FixedPoint[ truncate, n] < 10;p = 5; A024785 = {2, 3, 5}; While[(p = NextPrime[p]) < max, If[ok[p], AppendTo[A024785, p]]]; A024785 (* Jean-François Alcover, Nov 09 2011 *)
    d[n_]:=IntegerDigits[n]; ltrQ[n_]:=And@@PrimeQ[NestList[FromDigits[Drop[d[#],1]]&,n,Length[d[n]]-1]]; Select[Range[1225],ltrQ[#]&] (* Jayanta Basu, May 29 2013 *)
    FullList=Sort[Flatten[Table[FixedPointList[Select[Flatten[Table[Range[9]*10^Length@IntegerDigits[#[[1]]] + #[[i]], {i, Length[#]}]], PrimeQ] &, {i}], {i, {2, 3, 5, 7}}]]] (* Fabrice Laussy, Nov 10 2019 *)
  • PARI
    v=vector(4260);v[1]=2;v[2]=3;v[3]=5;v[4]=7;i=0;j=4; until(i>=j,i++;p=v[i];P10=10^(1+log(p)\log(10)); for(k=1,9,z=k*P10+p;if(isprime(z),j++;v[j]=z;))); s=vector(4260);s=vecsort(v);for(i=1,j,write("b024785.txt",i," ",s[i]);); \\
    
  • PARI
    is_A024785(n,t=1)={until(t>10*p,isprime(p=n%t*=10)||return);n==p} \\ M. F. Hasler, Apr 17 2014
    
  • PARI
    A024785=vector(25,n,p=vecsort(concat(apply(p->select(isprime, vector(9,i, i*10^(n-1)+p)),if(n>1,p))))); \\ Yields the list of rows (n-digit terms, n = 1..25). Use concat(%) to flatten. There are faster variants using matrices (vectorv(9,i,1)*p+[1..9]~*10^(n-1)*vector(#p,i,1)) and/or predefined vectors, but they are less concise and this takes less than 0.1 sec. - M. F. Hasler, Nov 07 2018
    
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], []
      while len(primes) > 0:
        alst += sorted(primes)
        candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        primes = [c for c in candidates if isprime(c)]
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021

A033664 Every suffix is prime.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97, 103, 107, 113, 137, 167, 173, 197, 223, 283, 307, 313, 317, 337, 347, 353, 367, 373, 383, 397, 443, 467, 503, 523, 547, 607, 613, 617, 643, 647, 653, 673, 683, 743, 773, 797, 823, 853, 883, 907, 937, 947
Offset: 1

Views

Author

Keywords

Comments

Primes in which repeatedly deleting the most significant digit gives a prime at every step until a single-digit prime remains.
Every digit string containing the least significant digit is prime. - Amarnath Murthy, Sep 24 2003

Crossrefs

Programs

  • Haskell
    a033664 n = a033664_list !! (n-1)
    a033664_list = filter (all ((== 1) . a010051. read) .
                               init . tail . tails . show) a000040_list
    -- Reinhard Zumkeller, Jul 10 2013
    
  • Maple
    T:= proc(n) option remember; `if`(n=0, "", select(isprime, [seq(seq(
          seq(parse(cat(j, 0$(n-i), p)), p=[T(i-1)]), i=1..n), j=1..9)])[])
        end:
    seq(T(n), n=1..4);  # Alois P. Heinz, Sep 01 2021
  • Mathematica
    h8pQ[n_]:=And@@PrimeQ/@Most[NestWhileList[FromDigits[Rest[ IntegerDigits[ #]]]&, n,#>0&]]; Select[Prime[Range[1000]],h8pQ] (* Harvey P. Dale, May 26 2011 *)
  • PARI
    fileO="b033664.txt";lim=8779;v=vector(lim);v[1]=2;v[2]=3;v[3]=5;v[4]=7;j=4; write(fileO,"1 2");write(fileO,"2 3");write(fileO,"3 5");write(fileO,"4 7"); p10=1;until(0,p10*=10;j0=j;for(k=1,9,k10=k*p10; for(i=1,j0,if(j==lim,break(3));z=k10+v[i]; if(isprime(z),j++;v[j]=z;write(fileO,j," ",z);)))) \\ Harry J. Smith, Sep 20 2008
    
  • Python
    from sympy import isprime, primerange
    def ok(p): # does prime p satisfy the property
        s = str(p)
        return all(isprime(int(s[i:])) for i in range(1, len(s)))
    print(list(filter(ok, primerange(1, 1000)))) # Michael S. Branicky, Sep 01 2021
    
  • Python
    # alternate for going to large numbers
    def agen(maxdigits):
        yield from [2, 3, 5, 7]
        primestrs, digits, d = ["2", "3", "5", "7"], "0123456789", 1
        while len(primestrs) > 0 and d < maxdigits:
            cands = set(d+p for p in primestrs for d in "0123456789")
            primestrs = [c for c in cands if c[0] == "0" or isprime(int(c))]
            yield from sorted(map(int, (p for p in primestrs if p[0] != "0")))
            d += 1
    print([p for p in agen(11)]) # Michael S. Branicky, Sep 01 2021

Extensions

More terms from Erich Friedman

A020994 Primes that are both left-truncatable and right-truncatable.

Original entry on oeis.org

2, 3, 5, 7, 23, 37, 53, 73, 313, 317, 373, 797, 3137, 3797, 739397
Offset: 1

Views

Author

Mario Velucchi (mathchess(AT)velucchi.it)

Keywords

Comments

Two-sided primes: deleting any number of digits at left or at right, but not both, leaves a prime.
Primes in which every digit string containing the most significant digit or the least significant digit is prime. - Amarnath Murthy, Sep 24 2003
Intersection of A024785 and A024770. - Robert Israel, Mar 23 2015

References

  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, p. 178 (Rev. ed. 1997).

Crossrefs

Programs

  • Mathematica
    tspQ[n_] := Module[{idn=IntegerDigits[n], l}, l=Length[idn]; Union[PrimeQ/@(FromDigits/@ Join[Table[Take[idn, i], {i, l}], Table[Take[idn, -i], {i, l}]])]=={True}] Select[Prime[Range[PrimePi[740000]]], tspQ]

Extensions

Corrected by David W. Wilson
Additional comments from Harvey P. Dale, Jul 10 2002

A050986 Number of n-digit right-truncatable primes.

Original entry on oeis.org

4, 9, 14, 16, 15, 12, 8, 5, 0
Offset: 1

Views

Author

Keywords

Comments

Right-truncatable means that the integer part of successive divisions by 10 always yields primes (or zero). - M. F. Hasler, Nov 07 2018

Crossrefs

Programs

  • PARI
    A050986=vector(9, n, #p=concat(apply(t->primes([t, t+1]*10), if(n>1, p)))) \\ M. F. Hasler, Nov 07 2018

Extensions

Edited by Ray Chandler, Mar 13 2007
a(9) = 0 added by M. F. Hasler, Nov 07 2018

A050987 Number of n-digit left-truncatable primes.

Original entry on oeis.org

4, 11, 39, 99, 192, 326, 429, 521, 545, 517, 448, 354, 276, 212, 117, 72, 42, 24, 13, 6, 5, 4, 3, 1, 0
Offset: 1

Views

Author

Keywords

Comments

The sequence is well defined for any positive integer, with a(n) = 0 for n >= 25. But it makes sense to consider it to be full & finite. - M. F. Hasler, Nov 07 2018

Crossrefs

Programs

  • PARI
    A050987=vector(25, n, #p=concat(apply(p->select(isprime, vector(9, i, i*10^(n-1)+p)), if(n>1, p)))) \\ M. F. Hasler, Nov 07 2018
    
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], [4]
      while len(primes) > 0:
        candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        primes = [c for c in candidates if isprime(c)]
        alst.append(len(primes))
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021

Extensions

Edited by Ray Chandler, Mar 13 2007
a(25) = 0 added by M. F. Hasler, Nov 07 2018

A052025 Every prefix (or suffix) of palindromic prime a(n) is prime (right/left-truncatable).

Original entry on oeis.org

2, 3, 5, 7, 313, 373, 797
Offset: 1

Views

Author

Keywords

Crossrefs

A076586 Total number of right truncatable primes in base n.

Original entry on oeis.org

0, 4, 7, 14, 36, 19, 68, 68, 83, 89, 179, 176, 439, 373, 414, 473, 839, 1010, 1577, 2271, 2848, 1762, 3376, 5913, 6795, 6352, 10319, 5866, 14639, 13303, 19439, 29982, 38956, 39323, 58857, 41646, 68371, 80754, 128859, 81453, 175734, 161438, 228543, 396274, 538797
Offset: 2

Views

Author

Martin Renner, Oct 20 2002, Sep 24 2007

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime, primerange
    from sympy.ntheory.digits import digits
    def fromdigits(digs, base):
        return sum(d*base**i for i, d in enumerate(digs))
    def a(n):
        prime_lists, an = [(p,) for p in primerange(1, n)], 0
        digits = 1
        while len(prime_lists) > 0:
            an += len(prime_lists)
            candidates = set((d,)+p for p in prime_lists for d in range(1, n))
            prime_lists = [c for c in candidates if isprime(fromdigits(c, n))]
            digits += 1
        return an
    print([a(n) for n in range(2, 27)]) # Michael S. Branicky, May 03 2022

A237600 Right-truncatable primes in base 16.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 37, 41, 43, 47, 53, 59, 61, 83, 89, 113, 127, 179, 181, 191, 211, 223, 593, 599, 601, 607, 659, 661, 691, 701, 757, 761, 853, 857, 859, 863, 947, 953, 977, 983, 991, 1427, 1429, 1433, 1439, 1811, 1823, 2039, 2879, 2897, 2903, 2909, 3061
Offset: 1

Views

Author

Stanislav Sykora, Feb 15 2014

Keywords

Comments

Numbers with these properties: (i) a(n) is a prime and (ii) its image under the function E(k) = k\16 = floor(k/16) is zero or has the same properties. [Corrected by M. F. Hasler, Nov 07 2018]
The sequence has 414 nonzero members.
Otherwise said, integers p > 0 such that floor(p/16^k) is prime or zero for all k >= 0. One might relax to p >= 0, i.e., include an initial term 0, corresponding to an empty string of digits. The recursive definition can also be used to produce all of the terms, starting with the primes < 16, and adding, for each term of the list, the primes made from appending a digit to that term, i.e., the primes between 16 x that term and 16 more. The sequence can also be seen as a table whose n-th row yields the terms with n digits in base 16: row lengths are A237601 and the last term of row n is A237602(n). - M. F. Hasler, Nov 07 2018

Examples

			a(414) = 16778492037124607, in hexadecimal notation 3B9BF319BD51FF, belongs to a(n) because each of its hexadecimal prefixes (including itself) is a prime. Being the largest of such numbers, it is also a member of A023107.
		

Crossrefs

Programs

  • Mathematica
    Select[Range@ 3600, AllTrue[Most[DeleteDuplicates@ FixedPointList[f, #]], PrimeQ] &] (* Michael De Vlieger, Mar 07 2015, Version 10 *)
  • PARI
    GT_Trunc1(nmax,prop,b=10) = { \\ See the link for details
      my (n=0,v=vector(nmax),g=1,lgs=1,lge,an,c);
      for (k=1,b-1,if (prop(k),v[n++]=k));
      lge=n; c=lge-lgs+1;
      while (c, g++;for (k=lgs,lge,for (m=0,b-1, an=b*v[k]+m;
        if (prop(an), v[n++]=an;if (n>=nmax,return (v)));););
        lgs=lge+1; lge=n; c=lge-lgs+1;);
      if (n, return (v[1..n]));
      print("No solution");}
    v = GT_Trunc1(1000000,isprime,16)
    
  • PARI
    isok(n)={ while(n, if(!isprime(n),return(0));n\=16); 1} \\ Joerg Arndt, Mar 07 2015
    
  • PARI
    my(A=primes([0,15]),i=1); until(#AA237600=A \\ M. F. Hasler, Nov 07 2018
    
  • Python
    from gmpy2 import is_prime
    A237600_list = []
    for n in range(1,10**9):
        if is_prime(n):
            s = format(n,'x')
            for i in range(1,len(s)):
                if not is_prime(int(s[:-i],16)):
                    break
            else:
                A237600_list.append(n) # Chai Wah Wu, Apr 16 2015
    
  • Python
    from sympy import primerange
    p = lambda x: list(primerange(x,x+16)); A237600 = p(0); i=0
    while iA237600): A237600+=p(A237600[i]*16); i+=1 # M. F. Hasler, Mar 11 2020
Showing 1-10 of 56 results. Next