OFFSET
1,1
COMMENTS
Conjecture: The sequence is finite.
From Michael De Vlieger, Dec 30 2017: (Start)
Primes > 5 in this sequence must only have digits that are in the reduced residue system modulo 10, i.e., {1, 3, 7, 9}.
There are 54 terms that have 6 or fewer decimal digits, the largest of which is 999331.
a(55) must be larger than 10^11. (End) [Corrected by Felix Fröhlich, Mar 15 + 24 2019]
From Felix Fröhlich, Mar 16 2019: (Start)
a(55) > 10^23 if it exists (cf. De Geest link).
LINKS
Felix Fröhlich, Table of n, a(n) for n = 1..54
P. De Geest, Circular Primes
EXAMPLE
The numbers resulting from cyclic permutations of the digits of 1193 are 1931, 9311 and 3119, respectively and all those numbers are prime, so 1193, 1931, 3119 and 9311 are terms of the sequence.
MATHEMATICA
Select[Prime@ Range[10^5], Function[w, And[AllTrue[Array[FromDigits@ RotateRight[w, #] &, Length@ w - 1], PrimeQ], Union@ w != {1} ]]@ IntegerDigits@ # &] (* or *)
Select[Flatten@ Array[FromDigits /@ Most@ Rest@ Tuples[{1, 3, 7, 9}, #] &, 9, 2], Function[w, And[AllTrue[Array[FromDigits@ RotateRight[w, #] &, Length@ w], PrimeQ], Union@ w != {1} ]]@ IntegerDigits@ # &] (* Michael De Vlieger, Dec 30 2017 *)
PROG
(PARI) eva(n) = subst(Pol(n), x, 10)
rot(n) = if(#Str(n)==1, v=vector(1), v=vector(#n-1)); for(i=2, #n, v[i-1]=n[i]); u=vector(#n); for(i=1, #n, u[i]=n[i]); v=concat(v, u[1]); v
is_circularprime(p) = my(d=digits(p), r=rot(d)); if(vecmin(d)==0, return(0), while(1, if(!ispseudoprime(eva(r)), return(0)); r=rot(r); if(r==d, return(1))))
forprime(p=1, , if(vecmax(digits(p)) > 1, if(is_circularprime(p), print1(p, ", "))))
(PARI) /* The following is a much faster program that only tests numbers whose decimal expansion consists of digits from the set {1, 3, 7, 9}. */
eva(n) = subst(Pol(n), x, 10)
next_v(vec) = my(k=#vec); if(vecmin(vec)==9, vec=concat(vector(#vec, t, 1), [3]); return(vec)); while(k > 0, if(vec[k]==9, vec[k]=1, if(vec[k]==3, vec[k]=7; return(vec), vec[k]=vec[k]+2, return(vec))); k--)
rot(n) = if(#Str(n)==1, v=vector(1), v=vector(#n-1)); for(i=2, #n, v[i-1]=n[i]); u=vector(#n); for(i=1, #n, u[i]=n[i]); v=concat(v, u[1]); v
search(n) = my(d=digits(n), e=[], ed=0); while(1, e=rot(d); while(1, if(!ispseudoprime(eva(e)), break, e=rot(e); if(e==d && ispseudoprime(eva(e)), print1(eva(d), ", "); break))); d=next_v(d))
searchfrom(n) = if(n < 12, forprime(p=n, 10, print1(p, ", ")); search(13), my(d=digits(n)); for(k=1, #d, if(d[k]%2==0, d[k]++, if(d[k]==5, d[k]=7))); search(eva(d)))
/* Start a search from 1 upwards as follows: */
searchfrom(1) \\ Felix Fröhlich, Mar 23 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Felix Fröhlich, Dec 30 2017
STATUS
approved