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.

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.

This page as a plain text file.
%I A380655 #61 Feb 25 2025 11:24:46
%S A380655 2,11,113,1193,11939,193939,71777393,913311913,93739179151,
%T A380655 317793117877,731779311787,1373779119729007
%N 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.
%e A380655 _n_p__shifts of digits by 1, ..., n-1 positions (n <= number of digits of p) to the left
%e A380655  1 2 -> ;
%e A380655  2 11 -> 11;
%e A380655  3 113 -> 131, 311;
%e A380655  4 1193 -> 1931, 9311, 3119;
%e A380655  5 11939 -> 19391, 93911, 39119, 91193;
%e A380655  6 193939 -> 939391, 393919, 939193, 391939, 919393;
%e A380655  7 71777393 -> 17773937, 77739371, 77393717, 73937177, 39371777, 93717773, but 37177739 = 29 * 683 * 1877;
%e A380655  8 913311913 -> 133119139, 331191391, 311913913, 119139133, 191391331, 913913311, 139133119, but 391331191 = 29 * 131 * 239 * 431;
%e A380655  9 93739179151 -> 37391791519, 73917915193, 39179151937, 91791519373, 17915193739, 79151937391, 91519373917, 15193739179, but 51937391791 = 419 * 887 * 139747;
%e A380655 10 317793117877 -> 177931178773, 779311787731, 793117877317, 931178773177, 311787731779, 117877317793, 178773177931, 787731779311, 877317793117, but 773177931178 = 2 * 386588965589;
%e A380655 11 731779311787 -> 317793117877, 177931178773, 779311787731, 793117877317, 931178773177, 311787731779, 117877317793, 178773177931, 787731779311, 877317793117, but 773177931178 = 2 * 386588965589;
%e A380655 12 1373779119729007 -> 3737791197290071, 7377911972900713, 3779119729007137, 7791197290071373, 7911972900713737, 9119729007137377, 1197290071373779, 1972900713737791, 9729007137377911, 7290071373779119, 2900713737791197, but 9007137377911972 = 2^2 * 13 * 6841 * 25320008821;
%o A380655 (Python)
%o A380655 from itertools import count, product
%o A380655 from sympy import isprime
%o A380655 def A380655(n):
%o A380655     if n == 1: return 2
%o A380655     for l in count(n):
%o A380655         for a in product('1379', repeat=n-1):
%o A380655             for b in product('0123456789', repeat=l-n):
%o A380655                 for c in '1379':
%o A380655                     d = ''.join(a+b)+c
%o A380655                     if all(isprime(int(d[i:]+d[:i])) for i in range(n)):
%o A380655                         return int(d) # _Chai Wah Wu_, Jan 30 2025
%Y A380655 Cf. A247153, A380669.
%K A380655 nonn,base,more
%O A380655 1,1
%A A380655 _Jean-Marc Rebert_, Jan 29 2025
%E A380655 a(10) and a(11) corrected by _Chai Wah Wu_, Jan 30 2025
%E A380655 Name edited by _Pontus von Brömssen_, Feb 03 2025
%E A380655 a(12) from _Chai Wah Wu_, Feb 06 2025