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

A127889 Smallest n-digit right-truncatable prime.

Original entry on oeis.org

2, 23, 233, 2333, 23333, 233993, 2339933, 23399339
Offset: 1

Views

Author

Ray Chandler, Feb 04 2007

Keywords

Comments

Agrees with A088603 for 8 terms, but this sequence ends there while A088603 continues.
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
    A127889=vector(8, n, p=concat(apply(t->primes([t, t+1]*10), if(n>1, p))); p[1]) \\ M. F. Hasler, Nov 07 2018

A298048 a(1) = number of 1-digit primes (that is, 4: 2,3,5,7); then a(n) = number of distinct n-digit prime numbers obtained by left- or right-concatenating a digit to the a(n-1) primes obtained in the previous iteration.

Original entry on oeis.org

4, 16, 70, 243, 638, 1450, 2819, 4951, 7629, 10677, 13267, 15182, 15923, 15796, 14369, 12547, 10291, 7939, 5703, 3911, 2559, 1595, 920, 561, 321, 167, 72, 37, 11, 6, 3
Offset: 1

Views

Author

Seiichi Manyama, Jan 11 2018

Keywords

Comments

A137812 lists the primes counted here. - Jon E. Schoenfield, Jan 28 2022

Examples

			2-digit primes:
-------------------
23   2->23 or 3->23
29   2->29
13   3->13
43   3->43
53   3->53 or 5->53
73   3->73 or 7->73
83   3->83
31   3->31
37   3->37 or 7->37
59   5->59
17   7->17
47   7->47
67   7->67
97   7->97
71   7->71
79   7->79
-------------------
a(2) = 16.
===================
3-digit primes:
[223, 233, 523, 823, 239, 229, 293, 829, 929, 113, 131, 313, 613, 137, 139, 311, 331, 431, 631, 317, 433, 443, 643, 743, 439, 353, 653, 853, 953, 173, 373, 733, 673, 773, 739, 337, 937, 379, 283, 383, 683, 883, 983, 839, 359, 593, 659, 859, 599, 617, 179, 271, 571, 971, 719, 347, 547, 647, 947, 479, 167, 367, 467, 677, 967, 197, 397, 797, 977, 997]
In the case of 223, 2->23 (adding the rightmost digit)->223 (adding the leftmost digit) and 2, 23 and 223 are prime.
In the case of 233, 2->23 (adding the rightmost digit)->233 (adding the rightmost digit) and 2, 23 and 233 are prime.
In the case of 523, 2->23 (adding the rightmost digit)->523 (adding the leftmost digit) and 2, 23 and 523 are prime.
a(3) = 70.
		

Crossrefs

Programs

  • Mathematica
    Block[{b = 10, t}, t = Select[Range[b], CoprimeQ[#, b] &]; TakeWhile[Length /@ Fold[Function[{a, n}, Append[a, Union[Join @@ {Join @@ Map[Function[k, Select[Map[Prepend[k, #] &, Range[b - 1]], PrimeQ@ FromDigits[#, b] &]], Last[a]], Join @@ Map[Function[k, Select[Map[Append[k, #] &, t], PrimeQ@ FromDigits[#, b] &]], Last[a]]}] ] ] @@ {#1, #2} &, {IntegerDigits[Prime@ Range@ PrimePi@ b, b]}, Range[2, 40]], # > 0 &]] (* Michael De Vlieger, Jan 21 2018 *)
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], []
      while len(primes) > 0:
        alst.append(len(primes))
        candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        candidates |= set(int(str(p)+d) for p in primes for d in "1379")
        primes = [c for c in candidates if isprime(c)]
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021
  • Ruby
    require 'prime'
    def A298048(n)
      ary = [2, 3, 5, 7]
      a_ary = [4]
      (n - 1).times{|i|
        ary1 = []
        ary.each{|a|
          (1..9).each{|d|
            j = d * 10 ** (i + 1) + a
            ary1 << j if j.prime?
            j = a * 10 + d
            ary1 << j if j.prime?
          }
        }
        ary = ary1.uniq
        a_ary << ary.size
      }
      a_ary
    end
    p A298048(10)
    

Extensions

a(16)-a(31) from Michael De Vlieger, Jan 21 2018

A127890 Largest n-digit right-truncatable prime.

Original entry on oeis.org

7, 79, 797, 7393, 73939, 739399, 7393933, 73939133
Offset: 1

Views

Author

Ray Chandler, Feb 04 2007

Keywords

Comments

For a variant see the Howard reference. - Alexander R. Povolotsky, Dec 23 2007
Right-truncatable means that the integer part of successive divisions by 10 always yields primes (or zero). - M. F. Hasler, Nov 07 2018

References

  • Toby Howard, "Magic Pi - The Magic of Numbers", PC Advisor magazine, May 1998.

Crossrefs

Programs

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

A297960 a(1) = number of 1-digit primes (that is, 4: 2,3,5,7); then a(n) = number of distinct n-digit prime numbers obtained by alternately right- and left-concatenating a digit to the a(n-1) primes obtained in the previous iteration.

Original entry on oeis.org

4, 9, 30, 49, 99, 74, 101, 71, 72, 35, 28, 9, 4
Offset: 1

Views

Author

Seiichi Manyama, Jan 09 2018

Keywords

Comments

No 14-digit numbers can be obtained from the four 13-digit numbers counted by a(13).

Examples

			1-digit   2-digit   3-digit    4-digit   ...  13-digit
------------------------------------------------------------
2         23        223        2237
                               2239
                    523        5231
                               5233
                               5237
                    823        8231
                               8233            6638182333331
                               8237
          29        229        2293
                               2297
                    829        8291
                               8293
                               8297
                    929        9293
3         31        131        1319
                    331        3313
                               3319
                    431
                    631        6311            5981563119937
                               6317
          37        137        1373
                    337        3371
                               3373
                    937        9371
                               9377
5         53        353        3533
                               3539
                    653
                    853        8537
                               8539
                    953        9533
                               9539
          59        359        3593
                    659        6599
                    859        8597
                               8599
7         71        271        2711
                               2713
                               2719
                    571        5711
                               5717
                    971        9719
          73        173        1733
                    373        3733
                               3739
                    673        6733            8313667333393
                               6737
                    773
          79        179
                    379        3793            2682637937713
                               3797
                    479        4793
                               4799
------------------------------------------------------------
a(1) = 4, a(2) = 9, a(3) = 30, a(4) = 49, ..., a(13) = 4.
		

Crossrefs

Programs

  • Mathematica
    Block[{b = 10, t}, t = Select[Range[b], CoprimeQ[#, b] &]; TakeWhile[Length /@ Fold[Function[{a, n}, Append[a, If[OddQ[n], Join @@ Map[Function[k, Select[Map[Prepend[k, #] &, Range[9]], PrimeQ@ FromDigits[#, b] &]], Last[a]], Join @@ Map[Function[k, Select[Map[Append[k, #] &, t], PrimeQ@ FromDigits[#, b] &]], Last[a]]]]] @@ {#1, #2} &, {IntegerDigits[Prime@ Range@ PrimePi@b, b]}, Range[2, 16]], # > 0 &]] (* Michael De Vlieger, Jan 20 2018 *)
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], []
      while len(primes) > 0:
        alst.append(len(primes))
        if len(alst)%2 == 0:
          candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        else:
          candidates = set(int(str(p)+d) for p in primes for d in "1379")
        primes = [c for c in candidates if isprime(c)]
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021

A297961 a(1) = number of 1-digit primes (that is, 4: 2,3,5,7); then a(n) = number of distinct n-digit prime numbers obtained by alternately left- and right-concatenating a digit to the a(n-1) primes obtained in the previous iteration.

Original entry on oeis.org

4, 11, 20, 53, 51, 100, 63, 76, 42, 43, 20, 13, 4, 4, 1
Offset: 1

Views

Author

Seiichi Manyama, Jan 09 2018

Keywords

Comments

No 16-digit numbers can be obtained from the 15-digit number 889292677731979.

Examples

			1-digit   2-digit    3-digit    4-digit   ...  15-digit
---------------------------------------------------------------
2
3         13         131        2131
                                6131
                     137        2137
                                3137
                                9137
                     139        4139
          23         233        5233
                                8233
                     239        2239
                                9239
          43         431        5431
                                8431
                                9431
                     433        1433
                                3433
                                7433
                                9433
                     439        1439
                                9439
          53
          73         733        1733
                                3733
                                4733
                                6733
                                9733
                     739        3739
                                9739
          83         839        5839
                                8839
                                9839
5
7         17         173        6173
                                9173
                     179        2179
                                5179
                                8179
          37         373        1373
                                3373
                                4373
                                6373
                     379        6379
          47         479        5479
                                9479
          67         673        3673
                                4673
                                6673
                                7673
                     677        2677            889292677731979
                                3677
                                8677
                                9677
          97         971        2971
                                6971
                                8971
                     977        6977
---------------------------------------------------------------
a(1) = 4, a(2) = 11, a(3) = 20, a(4) = 53, ..., a(15)= 1.
		

Crossrefs

Programs

  • Mathematica
    Block[{b = 10, t}, t = Select[Range[b], CoprimeQ[#, b] &]; TakeWhile[Length /@ Fold[Function[{a, n}, Append[a, If[EvenQ[n], Join @@ Map[Function[k, Select[Map[Prepend[k, #] &, Range[9]], PrimeQ@ FromDigits[#, b] &]], Last[a]], Join @@ Map[Function[k, Select[Map[Append[k, #] &, t], PrimeQ@ FromDigits[#, b] &]], Last[a]]]]] @@ {#1, #2} &, {IntegerDigits[Prime@ Range@ PrimePi@ b, b]}, Range[2, 16]], # > 0 &]] (* Michael De Vlieger, Jan 20 2018 *)
  • Python
    from sympy import isprime
    def alst():
      primes, alst = [2, 3, 5, 7], []
      while len(primes) > 0:
        alst.append(len(primes))
        if len(alst)%2 == 1:
          candidates = set(int(d+str(p)) for p in primes for d in "123456789")
        else:
          candidates = set(int(str(p)+d) for p in primes for d in "1379")
        primes = [c for c in candidates if isprime(c)]
      return alst
    print(alst()) # Michael S. Branicky, Apr 11 2021

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

A173060 Partial sums of A024785.

Original entry on oeis.org

2, 5, 10, 17, 30, 47, 70, 107, 150, 197, 250, 317, 390, 473, 570, 683, 820, 987, 1160, 1357, 1580, 1863, 2176, 2493, 2830, 3177, 3530, 3897, 4270, 4653, 5050, 5493, 5960, 6483, 7030, 7643, 8260, 8903, 9550, 10203, 10876, 11559, 12302, 13075, 13872
Offset: 1

Views

Author

Jonathan Vos Post, Feb 08 2010

Keywords

Comments

Partial sums of left-truncatable primes. This sequence has 4260 terms. The subsequence of prime partial sums of left-truncatable primes begins 2, 5, 17, 47, 107, 197, 317, 683, 7643. The subsubsequence of left-truncatable prime partial sums of left-truncatable primes begins 2, 5, 197, 317.

Examples

			a(57) = 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 + 1283 + 1367.
		

Crossrefs

Formula

a(n) = SUM[i=1..n] A024785(i) = SUM[i=1..n] {p prime, and every suffix of p in decimal expansion is prime, and no digits are zero}.
Previous Showing 11-17 of 17 results.