A068653 Composite numbers such that every cyclic shift (other than the number itself) gives a prime.
14, 16, 20, 30, 32, 34, 35, 38, 50, 70, 74, 76, 91, 92, 95, 98, 110, 118, 119, 133, 170, 176, 194, 310, 316, 398, 710, 712, 715, 730, 731, 736, 772, 775, 778, 779, 790, 793, 794, 914, 935, 970, 973, 1118, 1130, 1195, 1312, 1336, 1370, 1774, 1937, 3110, 3112
Offset: 1
Examples
176 is a term as the two cyclic shifts other than the number itself, 761 and 617, are primes.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..148 a(n) for n = 1..144 from Harvey P. Dale.
Programs
-
Mathematica
LiQ[n_] := Module[{s=0}, li1=IntegerDigits[n]; k=Length[li1]; t={li1}; Do[li1=RotateLeft[li1]; AppendTo[t,li1], {i,k-1}]; If[Length[Select[Table[FromDigits[p],{p,t}], PrimeQ]] == k-1, s=1]; s]; t1={}; Do[If[!PrimeQ[i] && LiQ[i]==1, AppendTo[t1,i]], {i,10,3112}]; t1 (* Jayanta Basu, May 03 2013 *) cppQ[n_]:=Module[{c=FromDigits/@NestList[RotateLeft[#]&,IntegerDigits[n], IntegerLength[ n]-1]},CompositeQ[c[[1]]]&&AllTrue[Rest[c],PrimeQ]]; Select[ Range[10,5000],cppQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 12 2014 *)
-
Python
from itertools import product from sympy import isprime A068653_list = [] for l in range(1,9): for m in product(('1379' if l > 1 else '123579'),repeat=l): for d in '0123456789': s = ''.join(m)+d n = int(s) if not isprime(n): for k in range(len(s)-1): s = s[1:]+s[0] if not isprime(int(s)): break else: A068653_list.append(n) # Chai Wah Wu, May 06 2017
Extensions
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 21 2002
Comments