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.
2, 11, 113, 1193, 11939, 193939, 71777393, 913311913, 93739179151, 317793117877, 731779311787, 1373779119729007
Offset: 1
Examples
_n_p__shifts of digits by 1, ..., n-1 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, but 37177739 = 29 * 683 * 1877; 8 913311913 -> 133119139, 331191391, 311913913, 119139133, 191391331, 913913311, 139133119, but 391331191 = 29 * 131 * 239 * 431; 9 93739179151 -> 37391791519, 73917915193, 39179151937, 91791519373, 17915193739, 79151937391, 91519373917, 15193739179, but 51937391791 = 419 * 887 * 139747; 10 317793117877 -> 177931178773, 779311787731, 793117877317, 931178773177, 311787731779, 117877317793, 178773177931, 787731779311, 877317793117, but 773177931178 = 2 * 386588965589; 11 731779311787 -> 317793117877, 177931178773, 779311787731, 793117877317, 931178773177, 311787731779, 117877317793, 178773177931, 787731779311, 877317793117, but 773177931178 = 2 * 386588965589; 12 1373779119729007 -> 3737791197290071, 7377911972900713, 3779119729007137, 7791197290071373, 7911972900713737, 9119729007137377, 1197290071373779, 1972900713737791, 9729007137377911, 7290071373779119, 2900713737791197, but 9007137377911972 = 2^2 * 13 * 6841 * 25320008821;
Programs
-
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
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