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

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

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

A202262 Composite numbers in which all substrings are composite.

Original entry on oeis.org

4, 6, 8, 9, 44, 46, 48, 49, 64, 66, 68, 69, 84, 86, 88, 94, 96, 98, 99, 444, 446, 448, 464, 466, 468, 469, 484, 486, 488, 494, 496, 498, 644, 646, 648, 649, 664, 666, 668, 669, 684, 686, 688, 694, 696, 698, 699, 844, 846, 848, 849, 864, 866, 868, 869, 884, 886
Offset: 1

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Subsequence of A062115, A202260, A029581.
Supersequence of A202265.
This is a 10-automatic sequence, see A071062. - Charles R Greathouse IV, Jan 01 2012

Crossrefs

Cf. A085823 (primes in which all substrings are primes), A068669 (noncomposite numbers in which all substrings are noncomposite), A062115 (nonprimes in which all substrings are nonprimes).
Cf. A010051.

Programs

  • Mathematica
    sub[n_] := Block[{d = IntegerDigits[n]}, Union@ Reap[ Do[Sow@ FromDigits@ Take[d, {i, j}], {j, Length@ d}, {i, j}]][[2, 1]]]; Select[ Range@ 900, Union[{4, 6, 8, 9}, IntegerDigits[#]] == {4, 6, 8, 9} && AllTrue[sub[#], CompositeQ] &] (* Giovanni Resta, Dec 20 2019 *)
  • PARI
    See Links section.

Extensions

Data corrected by Reinhard Zumkeller, May 05 2012
Data corrected by Rémy Sigrist, Dec 19 2019
Incorrect Haskell program deleted by M. F. Hasler, Dec 20 2019

A202265 Nonprime numbers in which all substrings and reversal substrings are nonprimes.

Original entry on oeis.org

0, 1, 4, 6, 8, 9, 10, 18, 40, 44, 46, 48, 49, 60, 64, 66, 68, 69, 80, 81, 84, 86, 88, 90, 94, 96, 99, 100, 108, 180, 184, 186, 400, 404, 406, 408, 440, 444, 446, 448, 460, 464, 466, 468, 469, 480, 481, 484, 486, 488, 490, 494, 496, 600, 604, 606, 608, 609
Offset: 1

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Subsequence of A062115, A202259.
Supersequence of A202266.

Examples

			All substrings and reversal substrings of 186 are nonprimes: 1, 6, 8, 18, 68, 81, 86, 186, 681.
		

Crossrefs

Cf. A202263 (primes in which all substrings and reversal substrings are primes), A068669 (noncomposite numbers in which all substrings and reversal substrings are noncomposites), A202266 (composite numbers in which all substrings and reversal substrings are composites).

Programs

  • Mathematica
    Select[Range[0,1000],NoneTrue[Union[Flatten[{#,IntegerReverse[#]}&/@Flatten[Table[ FromDigits/@Partition[IntegerDigits[#],d,1],{d,IntegerLength[#]}]]]],PrimeQ]&] (* Harvey P. Dale, Jul 30 2024 *)

Extensions

Corrected (498 deleted) by Harvey P. Dale, Jul 30 2024

A012884 Numbers such that every prefix and suffix is 1 or a prime.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 23, 31, 37, 53, 71, 73, 113, 131, 137, 173, 197, 311, 313, 317, 373, 797, 1373, 1997, 3137, 3797, 7331, 73331, 739397
Offset: 1

Views

Author

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

Keywords

Comments

Last term is 739397 (confirmed by David W. Wilson).
Intersection of A012883 and A143390. [Reinhard Zumkeller, Aug 13 2008]

Crossrefs

Cf. A068669.

Programs

  • Mathematica
    prQ[n_] := n == 1 || PrimeQ[n];
    okQ[n_] := Module[{dd, nd}, dd = IntegerDigits[n]; nd = Length[dd]; AllTrue[Range[nd], prQ@ FromDigits@ Take[dd, #]&] && AllTrue[Range[nd-1], prQ@ FromDigits@ Drop[dd, #]&]];
    {1}~Join~Select[Prime@Range[60000], okQ] (* Jean-François Alcover, Nov 20 2019 *)

A202263 Primes in which all substrings and reversal substrings are primes.

Original entry on oeis.org

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

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Sequence is finite with 7 terms.
Subsequence of A085823, A068669, A024770, A012883.

Examples

			All substrings and reversal substrings of 373 are primes:3, 7, 37, 73, 373.
		

Crossrefs

Cf. A202264 (noncomposite numbers in which all substrings and reversal substrings are noncomposite), A202265 (nonprimes in which all substrings and reversal substrings are nonprimes), A202266 (composite numbers in which all substrings and reversal substrings are composites).

A202264 Noncomposite numbers in which all substrings and reversal substrings are noncomposites.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 113, 131, 311, 313, 373
Offset: 1

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Sequence is finite with 17 terms.
Supersequence of A202263, A085823.
Subsequence of A068669, A012883, A024770, A012883.

Examples

			All substrings and reversal substrings of 311 are noncomposites: 1, 3, 11, 13, 31, 113, 311.
		

Crossrefs

Cf. A202263 (primes in which all substrings and reversal substrings are primes), A202265 (nonprimes in which all substrings and reversal substrings are nonprimes), A202266 (composite numbers in which all substrings and reversal substrings are composites).

A316412 Positive numbers m so that deletion of some or none but not all digits from m yields a noncomposite number.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 23, 31, 37, 53, 71, 73, 113, 131, 137, 173, 311, 317
Offset: 1

Views

Author

Matej Kripner, Aug 04 2018

Keywords

Comments

Subsequence of A068669. It is easy to see that these are the only terms from the said sequence that satisfy our definition; there are no more terms < 10000. If there is one >= 10000 then there would be one in [1000, 9999]. A contradiction hence the sequence is finite and full.
Also noncomposites m (in base 10) for which the concatenation of every subsequence of digits of m is noncomposite (in base 10). - David A. Corneth, Aug 08 2018

Examples

			317 is a member since all its subsequences, i.e., 3, 1, 7, 31, 17, 37, 317, are noncomposite.
313 is not a member since one of its subsequences (33) is composite.
		

Crossrefs

Subsequence of A068669.
Cf. A008578.

Programs

  • Mathematica
    Select[Range[10^3], AllTrue[FromDigits /@ Union@ Rest@ Subsets@ IntegerDigits@ #, ! CompositeQ@ # &] &] (* Michael De Vlieger, Aug 05 2018 *)

A366826 Composite numbers whose proper substrings (of their decimal expansions) are all primes.

Original entry on oeis.org

4, 6, 8, 9, 22, 25, 27, 32, 33, 35, 52, 55, 57, 72, 75, 77, 237, 537, 737
Offset: 1

Views

Author

Kalle Siukola, Oct 25 2023

Keywords

Comments

There are no terms greater than 999 because the only three-digit prime whose substrings are all primes is 373 (see A085823) and prepending or appending any prime digit to it would create a different three-digit substring.

Examples

			237 is included because it is composite and 2, 3, 7, 23 and 37 are all primes.
4 is included because it is composite and has no proper substrings.
		

Crossrefs

Subsequence of A002808.
Cf. A000040.

Programs

  • Python
    from itertools import combinations
    from sympy import isprime
    for n in range(2, 1000):
        if not isprime(n):
            properSubstrings = set(
                int(str(n)[start:end]) for (start, end)
                in combinations(range(len(str(n)) + 1), 2)
            ) - set((n,))
            if all(isprime(s) for s in properSubstrings):
                print(n, end=', ')
Showing 1-9 of 9 results.