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.

User: Wade Reece Eberly

Wade Reece Eberly's wiki page.

Wade Reece Eberly has authored 2 sequences.

A365276 Sum of all prime substrings of n in base 10, including n itself and duplicate or overlapping substrings but not substrings with a leading 0.

Original entry on oeis.org

0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 2, 16, 0, 5, 0, 24, 0, 19, 2, 2, 4, 28, 2, 7, 2, 9, 2, 31, 3, 34, 5, 6, 3, 8, 3, 47, 3, 3, 0, 41, 2, 46, 0, 5, 0, 54, 0, 0, 5, 5, 7, 61, 5, 10, 5, 12, 5, 64, 0, 61, 2, 3, 0, 5, 0, 74, 0, 0, 7, 78, 9, 83, 7, 12, 7, 14, 7, 86, 0
Offset: 0

Author

Wade Reece Eberly, Aug 30 2023

Keywords

Examples

			a(25) = 2 + 5 = 7.
a(37) = 3 + 7 + 37 = 47.
a(3002) = 3 + 2 = 5.
a(1235) = 2 + 3 + 5 + 23 = 33.
Example including duplicate and overlapping prime substrings:
a(227111) = 2 + 2 + 7 + 11 + 11 + 71 + 227 + 271 + 2711 + 227111 = 230424.
Note that in the above example, the substring 2 is incorporated into the sum twice because it appears twice in n.  The same is true of the substring 11, whose two appearances overlap each other in the final three digits of n.
Example wherein substrings with a leading 0 are to be ignored:
a(1002) = 2 because the substrings 002 and 02 are to be ignored due to the presence of a leading 0.
		

Crossrefs

Programs

  • PARI
    a(n)={my(v=digits(n)); sum(j=1, #v, sum(i=1, j, if(v[i], my(t=fromdigits(v[i..j])); t*isprime(t))))} \\ Andrew Howroyd, Aug 30 2023
    
  • Python
    from sympy import isprime
    def a(n):
        s = str(n)
        ss = (s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1))
        return sum(p for w in ss if w[0]!="0" and isprime(p:=int(w)))
    print([a(n) for n in range(81)]) # Michael S. Branicky, Aug 30 2023

Extensions

More terms from Andrew Howroyd, Aug 30 2023

A354947 Number of primes adjacent to prime(n) in a hexagonal spiral of positive integers.

Original entry on oeis.org

2, 2, 0, 2, 1, 1, 0, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0
Offset: 1

Author

Wade Reece Eberly, Sep 23 2022

Keywords

Examples

			The spiral begins
      13--12--11
      /         \
    14   4---3  10
    /   /     \   \
  15   5   1---2   9
    \   \         /
    16   6---7---8
      \
      17--18--19--...
For n=4, prime(4) = 7 in the spiral has a(4) = 2 primes adjacent (2 and 19).
		

Crossrefs

Cf. A307011, A307013 (spiral coordinates), A056105 (spiral first spoke).