login
A380655
Smallest prime p > 10^(n-1) for which successive cyclic shifts of digits by 1, ..., n-1 positions to the left are all prime, or -1 if no such p exists.
0
2, 11, 113, 1193, 11939, 193939, 71777393, 913311913, 93739179151, 317793117877, 731779311787, 1373779119729007
OFFSET
1,1
EXAMPLE
n p shifts of digits by n positions (n <= number of digits of p) to the left
1 2 -> ;
2 11 -> 11;
3 113 -> 131, 311;
4 1193 -> 1931, 9311, 3119;
5 11939 -> 19391, 93911, 39119, 91193;
6 193939 -> 939391, 393919, 939193, 391939, 919393;
7 71777393 -> 17773937, 77739371, 77393717, 73937177, 39371777, 93717773;
8 913311913 -> 133119139, 331191391, 311913913, 119139133, 191391331, 913913311, 139133119;
9 93739179151 -> 37391791519, 73917915193, 39179151937, 91791519373, 17915193739, 79151937391, 91519373917, 15193739179;
10 317793117877 -> 177931178773, 779311787731, 793117877317, 931178773177, 311787731779, 117877317793, 178773177931, 787731779311, 877317793117;
11 731779311787 -> 317793117877, 177931178773, 779311787731, 793117877317, 931178773177, 311787731779, 117877317793, 178773177931, 787731779311, 877317793117;
PROG
(Python)
from itertools import count, product
from sympy import isprime
def A380655(n):
if n == 1: return 2
for l in count(n):
for a in product('1379', repeat=n-1):
for b in product('0123456789', repeat=l-n):
for c in '1379':
d = ''.join(a+b)+c
if all(isprime(int(d[i:]+d[:i])) for i in range(n)):
return int(d) # Chai Wah Wu, Jan 30 2025
CROSSREFS
Cf. A247153.
Sequence in context: A205073 A069574 A090534 * A376447 A371697 A373795
KEYWORD
nonn,base,more,new
AUTHOR
Jean-Marc Rebert, Jan 29 2025
EXTENSIONS
a(10) and a(11) corrected by Chai Wah Wu, Jan 30 2025
Name edited by Pontus von Brömssen, Feb 03 2025
a(12) from Chai Wah Wu, Feb 06 2025
STATUS
approved