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-7 of 7 results.

A024770 Right-truncatable primes: every prefix is prime.

Original entry on oeis.org

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
Offset: 1

Views

Author

Keywords

Comments

Primes in which repeatedly deleting the least significant digit gives a prime at every step until a single-digit prime remains. The sequence ends at a(83) = 73939133 = A023107(10).
The subsequence which consists of the following "chain" of consecutive right truncatable primes: 73939133, 7393913, 739391, 73939, 7393, 739, 73, 7 yields the largest sum, compared with other chains formed from subsets of this sequence: 73939133 + 7393913 + 739391 + 73939 + 7393 + 739 + 73 + 7 = 82154588. - Alexander R. Povolotsky, Jan 22 2008
Can also be seen as a table whose n-th row lists the n-digit terms; row lengths (0 for n >= 9) are given by A050986. The sequence can be constructed starting with the single-digit primes and appending, for each p in the list, the primes within 10*p and 10(p+1), formed by appending a digit to p. - M. F. Hasler, Nov 07 2018

References

  • Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer London 2010, pp. 86-89.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 112-113.

Crossrefs

Supersequence of A085823, A202263. Subsequence of A012883, A068669. - Jaroslav Krizek, Jan 28 2012
Supersequence of A239747.
Cf. A033664, A024785 (left-truncatable primes), A032437, A020994, A052023, A052024, A052025, A050986, A050987, A069866, A077390 (left-and-right-truncatable primes), A137812 (left-or-right truncatable primes), A254751, A254753.
Cf. A237600 for the base-16 analog.

Programs

  • Haskell
    import Data.List (inits)
    a024770 n = a024770_list !! (n-1)
    a024770_list = filter (\x ->
       all (== 1) $ map (a010051 . read) $ tail $ inits $ show x) a038618_list
    -- Reinhard Zumkeller, Nov 01 2011
    
  • Maple
    s:=[1,3,7,9]: a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: do for j from l1 to l2 do for k from 1 to 4 do d:=[s[k],op(a[j])]: 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
  • Mathematica
    max = 100000; truncate[p_] := If[PrimeQ[q = Quotient[p, 10]], q, p]; ok[p_] := FixedPoint[ truncate, p] < 10; p = 1; A024770 = {}; While[ (p = NextPrime[p]) < max, If[ok[p], AppendTo[ A024770, p]]]; A024770 (* Jean-François Alcover, Nov 09 2011, after Pari *)
    eppQ[n_]:=AllTrue[FromDigits/@Table[Take[IntegerDigits[n],i],{i, IntegerLength[ n]-1}], PrimeQ]; Select[Prime[Range[3400]],eppQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jan 14 2015 *)
  • PARI
    {fileO="b024770.txt";v=vector(100);v[1]=2;v[2]=3;v[3]=5;v[4]=7;j=4;j1=1; write(fileO,"1 2");write(fileO,"2 3");write(fileO,"3 5");write(fileO,"4 7"); until(0,if(j1>j,break);new=1;for(i=j1,j,if(new,j1=j+1;new=0);for(k=1,9, z=10*v[i]+k;if(isprime(z),j++;v[j]=z;write(fileO,j," ",z);))));} \\ Harry J. Smith, Sep 20 2008
    
  • PARI
    for(n=2, 31193, v=n; while(isprime(n), c=n; n=(c-lift(Mod(c, 10)))/10); if(n==0, print1(v, ", ")); n=v); \\ Arkadiusz Wesolowski, Mar 20 2014
    
  • PARI
    A024770=vector(9, n, p=concat(apply(t->primes([t, t+1]*10), if(n>1, p)))) \\ The list of n-digit terms, 1 <= n <= 9. Use concat(%) to "flatten" it. - M. F. Hasler, Nov 07 2018
    
  • Python
    from sympy import primerange
    p = lambda x: list(primerange(x, x+10)); A024770 = p(0); i=0
    while iA024770): A024770+=p(A024770[i]*10); i+=1 # M. F. Hasler, Mar 11 2020

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

A254750 Numbers such that, in base 10, all their proper prefixes and suffixes represent composites.

Original entry on oeis.org

44, 46, 48, 49, 64, 66, 68, 69, 84, 86, 88, 89, 94, 96, 98, 99, 404, 406, 408, 409, 424, 426, 428, 444, 446, 448, 449, 454, 456, 458, 464, 466, 468, 469, 484, 486, 488, 494, 496, 498, 499, 604, 606, 608, 609, 624, 626, 628, 634, 636, 638
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 composite number.
The list is infinite because any string of two or more digits selected from {4,6,8} represents a member.
Each member a(n) starts, as well as ends, with one of the digits {4,6,8,9}.
Every proper prefix of each member a(n) is a member of A202260, and every proper suffix is a member of A254755.
The sequence is a union of A254752 and A254754.

Examples

			6 is not a member because its expansion cannot be sliced in two.
638 is a member because (6, 38, 63, and 8) are all composites.
		

Crossrefs

Programs

  • PARI
    isComposite(n) = (n>2)&&(!isprime(n));
    slicesIntoComposites(n,b=10) = {my(k=b);if(n0,if(!isComposite(n\k)||!isComposite(n%k),return(0););k*=b);return(1);}

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);

A254754 Prime numbers such that, in base 10, all their proper prefixes and suffixes represent composites.

Original entry on oeis.org

89, 409, 449, 499, 809, 4049, 4549, 4649, 4909, 4969, 6299, 6469, 6869, 6899, 6949, 8009, 8039, 8069, 8209, 8609, 8669, 8699, 8849, 9049, 9209, 9649, 9949, 40009, 40099, 40609, 40639, 40699, 40849, 42209, 42649, 44249, 44699, 45949, 46049, 46099
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: Slice the decimal expansion of the prime number a(n) in any way into two nonempty parts; then both parts represent a composite number.
This sequence is a subset of A254750. Each member a(n) must start with one of the digits {4,6,8,9} and end with 9.
Every proper prefix of each member a(n) is a member of A202260, and every proper suffix is a member of A254755.
These numbers are rare and tend to become rarer with increasing n, but the sequence does not seem to terminate (for example, 4*10^28 + 9 is a member).

Examples

			7 is not a member because its expansion cannot be sliced in two.
The prime 4969 is a member because it is a prime and the slices (4, 969, 49, 69, 496, and 9) are all composites.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[5,5000]],AllTrue[Flatten[Table[FromDigits/@TakeDrop[IntegerDigits[#],n],{n,IntegerLength[ #]-1}]],CompositeQ]&] (* Harvey P. Dale, Sep 22 2024 *)
  • PARI
    isComposite(n) = (n>2)&&(!isprime(n));
    slicesIntoComposites(n,b=10) = {my(k=b);if(n0,if(!isComposite(n\k)||!isComposite(n%k),return(0););k*=b);return(1);}
    isPrimeSlicingIntoComposites(n,b=10) = isprime(n) && slicesIntoComposites(n,b);

A254752 Composite numbers such that, in base 10, all their proper prefixes and suffixes represent composites.

Original entry on oeis.org

44, 46, 48, 49, 64, 66, 68, 69, 84, 86, 88, 94, 96, 98, 99, 404, 406, 408, 424, 426, 428, 444, 446, 448, 454, 456, 458, 464, 466, 468, 469, 484, 486, 488, 494, 496, 498, 604, 606, 608, 609, 624, 626, 628, 634, 636, 638, 639, 644, 646, 648, 649, 654, 656, 658, 664, 666, 668, 669, 684, 686, 688, 694, 696, 698, 699, 804, 806, 808, 814, 816, 818, 824, 826, 828
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 the composite number a(n) in any way into two nonempty parts, each part represents a composite number.
This list is infinite because any string of two or more digits selected from {4,6,8} is a member.
It is a subsequence of A254750 and shares with it these properties: Each member of a(n) must start, as well as end, with one of the digits {4,6,8,9}. Every proper prefix of each member a(n) is a member of A202260, and every proper suffix is a member of A254755.

Examples

			6 is not a member because its expansion cannot be sliced in two.
The composite 469 is a member because it is a composite and the slices (4, 69, 46, and 9) are all composites.
		

Crossrefs

Programs

  • PARI
    isComposite(n) = (n>2)&&(!isprime(n));
    slicesIntoComposites(n,b=10) = {my(k=b);if(n0,if(!isComposite(n\k)||!isComposite(n%k),return(0););k*=b);return(1);}
    isCompositeSlicingIntoComposites(n,b=10) = isComposite(n) && slicesIntoComposites(n,b);

A254756 Numbers such that all their proper hexadecimal prefixes and suffixes represent primes.

Original entry on oeis.org

34, 35, 37, 39, 43, 45, 50, 51, 53, 55, 59, 61, 82, 83, 85, 87, 91, 93, 114, 115, 117, 119, 123, 125, 178, 179, 181, 183, 187, 189, 210, 211, 213, 215, 219, 221, 595, 661, 663, 669, 691, 693, 763, 851, 947, 949, 979, 1333, 1339, 1341, 1429
Offset: 1

Views

Author

Stanislav Sykora, Mar 05 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 hexadecimal expansion of a(n) in any way into two nonempty parts, each part represents a prime number.
Every proper hexadecimal prefix of each member a(n) must be a member of A237600. Since the latter is a finite sequence, a(n) is also finite. It has exactly 100 members, the largest of which is 39441303 (not a prime; the largest of the 16 primes occurring in this sequence is 3389).
The relation of a(n) to A237600 leads to the fastest way to reliably enumerate all its members.

Examples

			13 is not a member because its expansion in base 16 (0xD) cannot be sliced in two. 33 (equal to 0x21) is also not a member because 1 is not a prime, while 34 (equal to 0x22) is a member because 2 is a prime.
1339, equal to 0x53B, is a member because all its proper hexadecimal prefixes and postfixes (0x5, 0x53, 0x3B, and 0xB) are prime.
The largest member is 0x259D397.
		

Crossrefs

Programs

  • PARI
    \\ For the function GT_Trunc1 see A237600 and/or the link.
    slicesIntoPrimes(n, b=10) = { \\ Same function as in A254751.
    my(k=b); if(n0, if(!isprime(n\k)||!isprime(n%k), return(0); ); k*=b; ); return(1); }
    NumbersSlicingIntoPrimes(nmax,b=10) = {
    my(rtp=GT_Trunc1(nmax,isprime,b)); \\ rtp right-truncatable primes
    my(a=vector(b*#rtp),irtp,d,an,n=0);
    for(irtp=1,#rtp, \\ For each rtp, append a digit and test
       for(d=0,b-1,an=b*rtp[irtp]+d;
         if(slicesIntoPrimes(an,b),n++;a[n]=an)););
    return(a[1..n]);} v = NumbersSlicingIntoPrimes(1000000,16) \\ Call with nmax>>414,base 16
    
  • Python
    from gmpy2 import is_prime
    A254756_list = []
    for n in range(16,10**6):
        s = format(n,'x')
        for i in range(1,len(s)):
            if not (is_prime(int(s[i:],16)) and is_prime(int(s[:-i],16))):
                break
        else:
            A254756_list.append(n) # Chai Wah Wu, Apr 16 2015
Showing 1-7 of 7 results.