login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A068653 Composite numbers such that every cyclic shift (other than the number itself) gives a prime. 7

%I #24 Dec 07 2018 17:29:56

%S 14,16,20,30,32,34,35,38,50,70,74,76,91,92,95,98,110,118,119,133,170,

%T 176,194,310,316,398,710,712,715,730,731,736,772,775,778,779,790,793,

%U 794,914,935,970,973,1118,1130,1195,1312,1336,1370,1774,1937,3110,3112

%N Composite numbers such that every cyclic shift (other than the number itself) gives a prime.

%C Single-digit numbers are excluded. There are only 144 terms up through 10 million. - _Harvey P. Dale_, Sep 12 2014

%H Chai Wah Wu, <a href="/A068653/b068653.txt">Table of n, a(n) for n = 1..148</a> a(n) for n = 1..144 from Harvey P. Dale.

%e 176 is a term as the two cyclic shifts other than the number itself, 761 and 617, are primes.

%t 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 *)

%t 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 *)

%o (Python)

%o from itertools import product

%o from sympy import isprime

%o A068653_list = []

%o for l in range(1,9):

%o for m in product(('1379' if l > 1 else '123579'),repeat=l):

%o for d in '0123456789':

%o s = ''.join(m)+d

%o n = int(s)

%o if not isprime(n):

%o for k in range(len(s)-1):

%o s = s[1:]+s[0]

%o if not isprime(int(s)):

%o break

%o else:

%o A068653_list.append(n) # _Chai Wah Wu_, May 06 2017

%Y Cf. A003459, A068652.

%K base,nonn

%O 1,1

%A _Amarnath Murthy_, Feb 28 2002

%E Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 21 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)