Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A359179
Concatenate n consecutive numbers 1..n in a clockwise circle such that n > 1 is also concatenated to 1. Then a(n) is the number (counting with multiplicity) of substrings of digits in this endless loop that are prime. No counting may go over the starting digit again, that is, no substring can extend beyond one full circle. Leading zeros are not allowed.
0
0, 1, 4, 5, 4, 7, 8, 10, 13, 17, 21, 22, 39, 41, 48, 51, 63, 65, 70, 66, 74, 75, 81, 84, 97, 93, 106, 113, 98, 109, 114, 123, 127, 150, 141, 152, 162, 161, 183, 184, 185, 186, 197, 207, 196, 213, 214, 216, 222, 208, 217, 217, 238, 226, 249, 230, 254, 249, 250
OFFSET
1,3
EXAMPLE
a(3) = 4 because there are four prime substrings in the circle: 2, 3, 23 and 31.
a(6) = 7. The seven prime substrings are 2, 3, 5, 23, 61, 4561 and 56123.
PROG
(Python)
from sympy import isprime
def a(n):
c = ("".join(str(i) for i in range(1, n+1)))*2
return sum(1 for i in range(len(c)//2) if c[i] != "0" for j in range(1, len(c)//2+1) if isprime(int(c[i:i+j])))
print([a(n) for n in range(1, 60)]) # Michael S. Branicky, Dec 17 2022
CROSSREFS
Cf. A000040.
Sequence in context: A074967 A021877 A355677 * A278713 A200623 A248671
KEYWORD
nonn,base
AUTHOR
Tamas Sandor Nagy, Dec 17 2022
EXTENSIONS
a(10) and beyond from Michael S. Branicky, Dec 17 2022
STATUS
approved