A293659 Base-6 circular primes that are not base-6 repunits.
11, 31, 71, 191, 211
Offset: 1
Examples
71 written in base 6 is 155. The base-6 numbers 155, 515, 551 written in base 10 are 71, 191, 211, respectively and all those numbers are prime, so 71, 191 and 211 are terms of the sequence.
Crossrefs
Programs
-
Mathematica
With[{b = 6}, Select[Prime@ Range[PrimePi@ b + 1, 10^6], Function[w, And[AllTrue[Array[FromDigits[RotateRight[w, #], b] &, Length@ w - 1], PrimeQ], Union@ w != {1} ]]@ IntegerDigits[#, b] &]] (* or *) With[{b = 6}, Select[Flatten@ Array[FromDigits[#, 6] & /@ Most@ Rest@ Tuples[{1, 5}, #] &, 18, 2], Function[w, And[ AllTrue[ Array[ FromDigits[ RotateRight[w, #], b] &, Length@ w], PrimeQ], Union@ w != {1} ]]@ IntegerDigits[#, b] &]] (* Michael De Vlieger, Dec 30 2017 *)
-
PARI
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 decimal(v, base) = my(w=[]); for(k=0, #v-1, w=concat(w, v[#v-k]*base^k)); sum(i=1, #w, w[i]) is_circularprime(p, base) = my(db=digits(p, base), r=rot(db), i=0); if(vecmin(db)==0, return(0), while(1, dec=decimal(r, base); if(!ispseudoprime(dec), return(0)); r=rot(r); if(r==db, return(1)))) forprime(p=1, , if(vecmin(digits(p, 6))!=vecmax(digits(p, 6)), if(is_circularprime(p, 6), print1(p, ", "))))
Comments