login
A293663
Circular primes that are not repunits.
13
2, 3, 5, 7, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 197, 199, 311, 337, 373, 719, 733, 919, 971, 991, 1193, 1931, 3119, 3779, 7793, 7937, 9311, 9377, 11939, 19391, 19937, 37199, 39119, 71993, 91193, 93719, 93911, 99371, 193939, 199933, 319993, 331999, 391939
OFFSET
1,1
COMMENTS
Relative complement of A004022 in A068652.
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).
Numbers k such that A262988(k) = A055642(k). (End)
LINKS
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
Cf. base-b nonrepunit circular primes: A293657 (b=4), A293658 (b=5), A293659 (b=6), A293660 (b=7), A293661 (b=8), A293662 (b=9).
Sequence in context: A118724 A055387 A046732 * A317688 A046703 A118722
KEYWORD
nonn,base
AUTHOR
Felix Fröhlich, Dec 30 2017
STATUS
approved