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.

Previous Showing 21-30 of 45 results. Next

A254751 Numbers such that, in base 10, all their proper prefixes and suffixes represent primes.

Original entry on oeis.org

22, 23, 25, 27, 32, 33, 35, 37, 52, 53, 55, 57, 72, 73, 75, 77, 237, 297, 313, 317, 373, 537, 597, 713, 717, 737, 797, 2337, 2397, 2937, 3113, 3137, 3173, 3797, 5937, 5997, 7197, 7337, 7397, 29397, 31373, 37937, 59397, 73313, 739397
Offset: 1

Views

Author

Stanislav Sykora, Feb 15 2015

Keywords

Comments

A proper prefix (or suffix) of a number m is one which is neither void, nor identical to m.
Alternative definition: Slicing the decimal expansion of a(n) in any way into two nonempty parts, each part represents a prime number.
Every proper prefix of each member a(n) is a member of A024770, and every proper suffix is a member of A024785. Since these are finite sequences, a(n) is also finite. It has 45 members, the largest of which is 739397 and happens to be a prime.
The sequence is a union of A254753 and A020994.
A subsequence of A260181. - M. F. Hasler, Sep 16 2016

Examples

			6 is not a member because its expansion cannot be sliced in two.
597 is a member because (5,97,59, and 7) are all primes.
2331 is excluded because 233 is prime, but 1 is not. - _Gordon Hamilton_, Feb 20 2015
		

Crossrefs

Programs

  • Mathematica
    fQ[n_] := (p = {2, 3, 5, 7}; If[ Union@ Join[p, {Mod[n, 10]}] != p, {False}, Block[{idn = IntegerDigits@ n, lng = Floor@ Log10@ n}, Union@ PrimeQ@ Flatten@ Table[{FromDigits[ Take[idn, i]], FromDigits[ Take[idn, -lng + i - 1]]}, {i, lng}] == {True}]]); Select[ Range@1000000, fQ] (* Robert G. Wilson v, Feb 21 2015 *)
    Select[Range[10,750000],AllTrue[Flatten[Table[FromDigits/@TakeDrop[IntegerDigits[#],n],{n,IntegerLength[#]-1}]],PrimeQ]&] (* Harvey P. Dale, Feb 13 2024 *)
  • PARI
    slicesIntoPrimes(n,b=10) = {my(k=b);if(n0,if(!isprime(n\k)||!isprime(n%k),return(0););k*=b;);return(1);}
    
  • Sage
    def breakIntoPrimes(n):
        D=n.digits()
        for i in [1..len(D)-1]:
            if not(is_prime(sum(D[i:][j]*10^j for j in range(len(D[i:])))) and is_prime(sum(D[:i][j]*10^j for j in range(len(D[:i]))))):
                return False
            else:
                continue
        return True
    [n for n in [10..1000] if breakIntoPrimes(n)] # Tom Edgar, Feb 20 2015

A254753 Composite numbers with only prime proper prefixes and suffixes in base 10.

Original entry on oeis.org

22, 25, 27, 32, 33, 35, 52, 55, 57, 72, 75, 77, 237, 297, 537, 597, 713, 717, 737, 2337, 2397, 2937, 3113, 3173, 5937, 5997, 7197, 7337, 7397, 29397, 31373, 37937, 59397, 73313
Offset: 1

Views

Author

Stanislav Sykora, Feb 15 2015

Keywords

Comments

A proper prefix (or suffix) of a number m is one which is neither void, nor identical to m.
Alternative definition: Slicing the decimal expansion of a composite a(n) in any way into two nonempty parts, each part represents a prime number.
This sequence is a subset of A254751. Every proper prefix of each member a(n) is a member of A024770, and every proper suffix is a member of A024785. Since the latter are finite sequences, a(n) is also a finite sequence. It has 34 members, the largest of which is the composite number 73313.
Should one change the definition to 'prime numbers such that, in base 10, all their proper prefixes and suffixes represent primes', the result would be the sequence A020994.

Examples

			6 is not a member because its expansion cannot be sliced in two.
The composite 73313 is a member because (7, 3313, 73, 313, 733, 13, 7331, 3) are all primes.
		

Crossrefs

Programs

  • Mathematica
    apQ[n_]:=Module[{idn=IntegerDigits[n],c1,c2},c1=FromDigits/@ Table[ Take[ idn,k],{k,Length[idn]-1}];c2=FromDigits/@Table[Take[idn,k],{k,-(Length[ idn]-1), -1}]; AllTrue[ Join[c1,c2],PrimeQ]]; Select[Range[ 10,80000], CompositeQ[#] && apQ[#]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Nov 29 2018 *)
  • PARI
    isComposite(n) = (n>2)&&(!isprime(n));
    slicesIntoPrimes(n,b=10) = {my(k=b);if(n0,if(!isprime(n\k)||!isprime(n%k),return(0););k*=b;);1;}
    isCompositeSlicingIntoPrimes(n,b=10) = isComposite(n) && slicesIntoPrimes(n,b);

A101115 Beginning with the n-th prime, the number of successive times a new prime can be formed by prepending the smallest nonzero digit.

Original entry on oeis.org

0, 5, 0, 9, 5, 4, 8, 4, 5, 9, 4, 6, 2, 7, 6, 8, 9, 7, 6, 3, 14, 5, 5, 2, 4, 10, 1, 5, 7, 3, 4, 3, 5, 5, 0, 6, 5, 8, 5, 13, 4, 5, 4, 5, 3, 8, 4, 4, 5, 8, 3, 6, 1, 4, 4, 2, 5, 2, 2, 3, 4, 9, 8, 7, 4, 7, 3, 3, 5, 5, 7, 8, 4, 3, 3, 2, 1, 7, 0, 4, 3, 5, 3, 7, 9, 6, 6, 5, 6, 8
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Comments

It is possible the procedure described would generate some left-truncatable primes (A024785). Although zero digits cannot be added, it is possible the starting prime may contain zeros. Therefore the possible number of digit additions is not limited by the length of the largest known left-truncatable prime. Further, because the smallest digit that satisfies the requirement is used each time, it is possible that choosing a larger digit would allow more single digits to be added. Therefore although some of the set of left-truncatable primes may be generated by this practice, not all of them will.
In principle it is possible that some a(n) is undefined because the process could go on indefinitely, but this is very unlikely. The largest a(n) for n <= 300000 is a(49120) = 18. - Robert Israel, Jun 29 2015

Examples

			a(2) is 5 because the second prime is 3, to which single nonzero digits can be prepended 5 times yielding a new prime each time (giving preference to the smallest digit that satisfies the requirement): 13, 113, 2113, 12113, 612113 (see A053583). There is no nonzero digit which can be prepended to 612113 to yield a new prime.
a(21) = 14 because the 21st prime (73) can be prepended with single nonzero digits 14 times yielding a new prime each time: 73, 173, 6173, 66173, ..., 4818372912366173.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p, nd, d, count, x, success;
          p:= ithprime(n); nd:= ilog10(p);
          for count from 0 do
            nd:= nd+1;
            success:= false;
            for d from 1 to 9 do
              x:= 10^nd * d + p;
              if isprime(x) then
                 success:= true;
                 break
              fi
            od;
            if not success then return(count) fi;
            p:= x;
          od
    end proc:
    map(f, [$1..100]); # Robert Israel, Jun 29 2015
  • Python
    from sympy import isprime, prime
    def a(n):
        pn = prime(n)
        s, c, found = str(pn), 0, True
        while found:
            found = False
            for d in "123456789":
                if isprime(int(d+s)):
                    s, c, found = d+s, c+1, True
                    break
        return c
    print([a(n) for n in range(1, 91)]) # Michael S. Branicky, Jun 24 2022

A101116 Values in A101115 which are records.

Original entry on oeis.org

0, 5, 9, 14, 15, 18, 19, 20, 22
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Comments

All primes up to 1000003 have been tested.

Crossrefs

Programs

  • Python
    from sympy import isprime, nextprime
    def agen(): # generator of tuple of terms of (A101116, A101117, A101118)
        n, pn, record = 0, 1, -1
        while True:
            n += 1
            pn = nextprime(pn)
            s, c, found = str(pn), 0, True
            while found:
                found = False
                for d in "123456789":
                    if isprime(int(d+s)):
                        s, c, found = d+s, c+1, True
                        break
            if c > record:
                record = c
                yield record, pn, int(s)
    g = agen()
    print([next(g)[0] for n in range(1, 7)]) # Michael S. Branicky, Jun 24 2022

Extensions

a(7)-a(8) from Michael S. Branicky, Jun 24 2022
a(9) from Michael S. Branicky, Jul 26 2024

A101118 a(n) = the resulting prime generated when the process described in A101115 is applied to A101117(n).

Original entry on oeis.org

2, 612113, 5372126317, 4818372912366173, 21291981879276213799, 912733515196363393600307, 668334992181698187977197951, 231879245133561335194866134641, 933651219687395363156136052921903
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Examples

			a(3) = 5372126317 because 5372126317 is the last prime that can be generated by successively prepending nonzero digits to A101117(3). A101117(3) is 7. A101116(3) indicates that 9 digits can be successively prepended to 7 generating a new prime each time. Doing so and giving preference to the smallest digit which meets the requirement, generates the following primes: 17, 317, 6317, 26317, 126317, 2126317, 72126317, 372126317, 5372126317.
		

Crossrefs

Programs

  • Python
    g = agen() # uses agen() and imports from A101116
    print([next(g)[2] for n in range(1, 7)]) # Michael S. Branicky, Jun 24 2022

Extensions

a(7)-a(8) and typo corrected in a(6) from Michael S. Branicky, Jun 24 2022
a(9) from Michael S. Branicky, Jul 26 2024

A012885 Suffixes of 357686312646216567629137 (all primes).

Original entry on oeis.org

7, 37, 137, 9137, 29137, 629137, 7629137, 67629137, 567629137, 6567629137, 16567629137, 216567629137, 6216567629137, 46216567629137, 646216567629137, 2646216567629137, 12646216567629137, 312646216567629137, 6312646216567629137, 86312646216567629137
Offset: 1

Views

Author

Larry Calmer (larry(AT)wri.com), Simon Plouffe

Keywords

Comments

From Mikk Heidemaa, Mar 23 2015: (Start)
a(2),...,a(24) all have a single representation (in positive integers) as the sum of two squares (e.g., a(24) = 416865370156^2 + 428846797599^2) and as the hypotenuse of a primitive Pythagorean triple (357686312646216567629137^2 = 10132838975618776700465^2 + 357542758042644694110888^2).
---
a^2 + b^2 + c^2 + d^2 + e^2 + f^2 = 357686312646216567629137^2;
a=304233682432674451033719; b=185074861663432734470527;
c=4189176178164916432878; d=33333333333333333333333; e=3333333; f=3.
---
a^2 + b^2 + c^2 + d^2 + e^2 + f^2 = 357686312646216567629137^3;
a=210197737649788368191109924028342434;
b=39738123500625252940689952285037741;
c=777777777777777777777777;
d=777777777777777777777777;
e=777777777777777777;
f=777777777777.
a=170350493188466620042802284807886346;
b=129394423538599186274382140531063939;
c=777777777777777777777777;
d=777777777777777777777777;
e=777777777777777777;
f=777777777777.
---
x^2 + y^2 = 357686312646216567629137^3;
x=144701758632763782416276428525674993;
y=157555096461604743754426503960480452;
x=149107037120999813337660002835835372;
y=153392629723324670471173010334042063.
(End)

Examples

			.......................7
......................37
.....................137
....................9137
...................29137
..................629137
.................7629137
................67629137
...............567629137
..............6567629137
.............16567629137
............216567629137
...........6216567629137
..........46216567629137
.........646216567629137
........2646216567629137
.......12646216567629137
......312646216567629137
.....6312646216567629137
....86312646216567629137
...686312646216567629137
..7686312646216567629137
.57686312646216567629137
357686312646216567629137
------------------------
		

Crossrefs

Cf. A024785.

Programs

Formula

a(n) = 357686312646216567629137 mod 10^n. - José de Jesús Camacho Medina, Dec 21 2016

A055521 Restricted left truncatable (Henry VIII) primes.

Original entry on oeis.org

773, 3373, 3947, 4643, 5113, 6397, 6967, 7937, 15647, 16823, 24373, 33547, 34337, 37643, 56983, 57853, 59743, 62383, 63347, 63617, 69337, 72467, 72617, 75653, 76367, 87643, 92683, 97883, 98317, 121997, 124337, 163853, 213613, 236653
Offset: 1

Views

Author

Keywords

Comments

There are 1440 such primes, the largest being 357686312646216567629137.
Left-truncatable primes (A024785) which have at least two digits and are not the end of a larger left-truncatable prime. - Jens Kruse Andersen, Jul 29 2014

Examples

			773 is in the sequence since 773, 73, 3 are primes, while no digit 1..9 gives a prime if placed before 773. 13 is not in the sequence since for example 113 is prime. 2 and 5 are disqualified for only having one digit. - _Jens Kruse Andersen_, Jul 29 2014
		

References

  • Kahan, S. and Weintraub, S. "Left Truncatable Primes." J. Recr. Math. 29, 254-264, 1998.

Crossrefs

Cf. A024785.

Programs

  • Python
    from sympy import isprime, primerange
    def afull():
        alst, prime_strs, an, digits = [], ["2", "3", "5", "7"], 0, 1
        while len(prime_strs) > 0:
            new_prime_strs = set()
            for p in prime_strs:
                can_extend = False
                for d in "123456789":
                    c = d + p
                    if isprime(int(c)):
                        can_extend = True
                        new_prime_strs.add(c)
                if digits > 1 and not can_extend:
                    alst.append(int(p))
            prime_strs = new_prime_strs
            digits += 1
        return sorted(alst)
    print(afull()) # Michael S. Branicky, Dec 11 2022

A101117 a(n) = the first prime yielding the record value A101116(n).

Original entry on oeis.org

2, 3, 7, 73, 13799, 600307, 77197951, 4866134641, 36052921903
Offset: 1

Views

Author

Chuck Seggelin (seqfan(AT)plastereddragon.com), Dec 02 2004

Keywords

Examples

			a(6) = 600307 because 600307 is the first prime to which A101116(6) digits (18) can be prepended yielding a new prime each time (giving preference to the smallest digit which meets the requirement) - 600307, 3600307, 93600307, ..., 9912733515196363393600307.
		

Crossrefs

Programs

  • Python
    g = agen() # uses agen() and imports from A101116
    print([next(g)[1] for n in range(1, 7)]) # Michael S. Branicky, Jun 24 2022

Extensions

a(7)-a(8) from Michael S. Branicky, Jun 24 2022
a(9) from Michael S. Branicky, Jul 26 2024

A127891 Smallest n-digit left-truncatable prime.

Original entry on oeis.org

2, 13, 113, 1223, 12113, 121283, 1237547, 12184967, 124536947, 1219861613, 12181833347, 121339693967, 1213536676883, 12673876537547, 121848768729173, 1275463876537547, 12429121339693967, 165678739293946997, 1276812967623946997, 15396334245663786197, 315396334245663786197, 5918918997653319693967, 57686312646216567629137, 357686312646216567629137
Offset: 1

Views

Author

Ray Chandler, Feb 04 2007

Keywords

Comments

Ends at a(24) = 357686312646216567629137.
Agrees with A088604 for 24 terms, but this sequence ends there while A088604 continues.

Crossrefs

Programs

  • Mathematica
    grow[p_, digits_] := Select[ Table[ FromDigits[Join[{k}, IntegerDigits[p]]], {k, 1, 9}], PrimeQ[#] && Length[ IntegerDigits[#]] == digits&]; g[1] = {3, 7}; g[n_] := g[n] = grow[#, n]& /@ g[n-1] // Flatten; a[1] = 2; a[n_] := Min[g[n]]; Table[a[n], {n, 1, 24}] (* Jean-François Alcover, Aug 05 2013 *)

A127892 Largest n-digit left-truncatable prime.

Original entry on oeis.org

7, 97, 997, 9967, 99643, 998443, 9986113, 99979337, 999962683, 9987983617, 99978397283, 999631686353, 9997564326947, 99769267986197, 999769267986197, 9957969395462467, 99957969395462467, 992429121339693967, 8963315421273233617, 86312646216567629137
Offset: 1

Views

Author

Ray Chandler, Feb 04 2007

Keywords

Comments

Ends at a(24) = 357686312646216567629137.

Crossrefs

Previous Showing 21-30 of 45 results. Next