A293142
Largest nonrepunit base-n circular prime (conjectured).
Original entry on oeis.org
7, 1013, 3121, 211
Offset: 3
1013 written in base 4 is 33311. The base-4 numbers 33311, 33113, 31133, 11333, 13331 written in base 10 are 1013, 983, 863, 383 and 509, respectively. All those base-10 numbers are prime and since there is no larger prime up to 12 base-4 digits where all cyclic permutations of base-4 digits are primes, 1013 is conjectured to be the largest nonrepunit circular prime in base 4.
-
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))))
a(base, maxlength) = my(p=precprime(base^maxlength)); while(p > 2, if(vecmin(digits(p, base))!=vecmax(digits(p, base)), if(is_circularprime(p, base), return(p))); p=precprime(p-1))
for(n=3, 6, print1(a(n, 12), ", ")) \\ start searching a(n) from largest prime with 12 base-n digits backwards
A293660
Base-7 circular primes that are not base-7 repunits.
Original entry on oeis.org
11, 13, 17, 19, 23, 29, 37, 41, 43, 47, 79, 89, 97, 109, 131, 211, 233, 257, 263, 281, 307, 337, 439, 479, 509, 571, 619, 673, 677, 853, 941, 953, 977, 997, 1021, 1097, 1117, 1163, 1171, 1453, 1511, 1531, 1579, 1597, 1657, 1777, 1787, 1811, 1871, 1933, 1951
Offset: 1
109 written in base 7 is 214. The base-7 numbers 214, 142, 421 written in base 10 are 109, 79, 211, respectively, and all those numbers are prime, so 79, 109 and 211 are terms of the sequence.
-
With[{b = 7}, Select[Prime@ Range[PrimePi@ b + 1, 300], Function[w, And[AllTrue[Array[FromDigits[RotateRight[w, #], b] &, Length@ w - 1], PrimeQ], Union@ w != {1} ]]@ IntegerDigits[#, b] &]] (* Michael De Vlieger, Dec 30 2017 *)
-
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, 7))!=vecmax(digits(p, 7)), if(is_circularprime(p, 7), print1(p, ", "))))
A317716
Square array A(n, k), read by antidiagonals downwards: k-th prime p such that cyclic digit shifts produce exactly n different primes.
Original entry on oeis.org
2, 3, 13, 5, 17, 113, 7, 31, 131, 1193, 11, 37, 197, 1931, 11939, 19, 71, 199, 3119, 19391, 193939, 23, 73, 311, 3779, 19937, 199933, 17773937, 29, 79, 337, 7793, 37199, 319993, 39371777, 119139133, 41, 97, 373, 7937, 39119, 331999, 71777393, 133119139
Offset: 1
Array starts
2, 3, 5, 7, 11, 19, 23, ...
13, 17, 31, 37, 71, 73, 79, ...
113, 131, 197, 199, 311, 337, 373, ...
1193, 1931, 3119, 3779, 7793, 7937, 9311, ...
11939, 19391, 19937, 37199, 39119, 71993, 91193, ...
193939, 199933, 319993, 331999, 391939, 393919, 919393, ...
17773937, 39371777, 71777393, 73937177, 77393717, 77739371, 93717773, ...
119139133, 133119139, 139133119, 191391331, 311913913, 331191391, 913311913, ...
...
-
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
count_primes(n) = my(d=digits(n), i=0); while(1, if(ispseudoprime(eva(d)), i++); d=rot(d); if(d==digits(n), return(i)))
row(n, terms) = my(i=0); forprime(p=1, , if(count_primes(p)==n, print1(p, ", "); i++); if(i==terms, print(""); break))
array(rows, cols) = for(x=1, rows, row(x, cols))
array(7, 7) \\ print initial 7 rows and 7 columns of array
A016114
The smallest representative in a cycle of circular primes, where circular primes are numbers that remain prime under cyclic shifts of digits.
Original entry on oeis.org
2, 3, 5, 7, 11, 13, 17, 37, 79, 113, 197, 199, 337, 1193, 3779, 11939, 19937, 193939, 199933, 1111111111111111111, 11111111111111111111111
Offset: 1
- K. S. Brown, On General Palindromic Numbers
- Chris K. Caldwell, Circular Primes
- Patrick De Geest, Circular Primes
- James Grime and Brady Haran, Absolute Primes, YouTube Numberphile video, 2024.
- Harvey Heinz, Prime Patterns (Illustration using 19937)
- Ernest G. Hibbs, Component Interactions of the Prime Numbers, Ph. D. Thesis, Capitol Technology Univ. (2022), see p. 33.
- Gianni Sarcone, Tourbillonnants nombres premiers, Tangente Web Site, No date.
For a sequence listing all the prime-yielding cyclic permutations see
A068652.
-
circularPrimeQ[p_] := Module[{d = IntegerDigits[p], ps}, ps = Table[FromDigits[d = RotateLeft[d]], {Length[d]}]; If[p > Min[ps], False, And @@ PrimeQ[ps]]]; Select[Prime[Range[100000]], circularPrimeQ] (* T. D. Noe, Mar 22 2012 *)
Union[Select[Union/@((FromDigits/@Table[RotateRight[IntegerDigits[#],n],{n,IntegerLength[ #]}])&/@Prime[Range[20000]]),AllTrue[#,PrimeQ]&]][[All,1]] (* The program generates the first 19 terms of the sequence. *) (* Harvey P. Dale, Nov 14 2022 *)
A293657
Base-4 circular primes that are not base-4 repunits.
Original entry on oeis.org
7, 13, 23, 29, 53, 383, 509, 863, 983, 1013
Offset: 1
53 written in base 4 is 311. The base-4 numbers 311, 131, 113 written in base 10 are 53, 29, 23, respectively and all those numbers are prime, so 23, 29 and 53 are terms of the sequence.
-
With[{b = 4}, Select[Array[Map[If[Union@ # == {1}, 0, FromDigits[#, b]] &, NestList[RotateLeft, #, Length@ # - 1]] &@ IntegerDigits[Prime@ #, b] &, 10^6, If[PrimeQ@ b, #, # + 1] &@ PrimePi@ b], AllTrue[#, PrimeQ] &][[All, 1]] ] (* Michael De Vlieger, Nov 26 2017 *)
With[{b = 4}, Select[Flatten@ Array[FromDigits[#, b] & /@ Most@ Rest@ Tuples[{1, 3}, #] &, 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 *)
-
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, 4))!=vecmax(digits(p, 4)), if(is_circularprime(p, 4), print1(p, ", "))))
A293658
Base-5 circular primes that are not base-5 repunits.
Original entry on oeis.org
7, 11, 13, 17, 19, 23, 167, 211, 239, 283, 359, 431, 547, 571, 1069, 1249, 1733, 2221, 2417, 2713, 2749, 3049, 3109, 3121
Offset: 1
1069 written in base 5 is 13234. The base-5 numbers 13234, 32341, 23413, 34132, 41323 written in base 10 are 1069, 2221, 1733, 2417, 2713, respectively and all those numbers are prime, so 1069, 1733, 2221, 2417 and 2713 are terms of the sequence.
-
Select[Array[Map[If[Union@ # == {1}, 0, FromDigits[#, 5]] &, NestList[RotateLeft, #, Length@ # - 1]] &@ IntegerDigits[Prime@ #, 5] &, 10^5, 4], AllTrue[#, PrimeQ] &][[All, 1]] (* Michael De Vlieger, Nov 26 2017 *)
-
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, 5))!=vecmax(digits(p, 5)), if(is_circularprime(p, 5), print1(p, ", "))))
A293659
Base-6 circular primes that are not base-6 repunits.
Original entry on oeis.org
11, 31, 71, 191, 211
Offset: 1
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.
-
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 *)
-
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, ", "))))
A293661
Base-8 circular primes that are not base-8 repunits.
Original entry on oeis.org
13, 29, 31, 41, 43, 47, 59, 61, 607, 719, 751, 761, 971, 1021, 1657, 1759, 1787, 1913, 1993, 2011, 2687, 3019, 3659, 3673, 3677, 3803, 3919, 4073, 49103, 56299, 62207, 105341, 130681, 177007, 188249, 195277, 235513, 237151, 251501, 259019, 4127707, 6807419
Offset: 1
607 written in base 8 is 1137. The base-8 numbers 1137, 1371, 3711, 7113 written in base 10 are 607, 761, 1993, 3659, respectively, and all those numbers are prime, so 607, 761, 1993 and 3659 are terms of the sequence.
-
With[{b = 8}, 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 = 8}, Select[Flatten@ Array[FromDigits[#, b] & /@ Most@ Rest@ Tuples[Range[1, 7, 2], #] &, 6, 2], Function[w, And[ AllTrue[ Array[ FromDigits[ RotateRight[w, #], b] &, Length@ w], PrimeQ], Union@ w != {1} ]]@ IntegerDigits[#, b] &]] (* Michael De Vlieger, Dec 30 2017 *)
-
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, 8))!=vecmax(digits(p, 8)), if(is_circularprime(p, 8), print1(p, ", "))))
A293662
Base-9 circular primes that are not base-9 repunits.
Original entry on oeis.org
11, 13, 17, 19, 23, 37, 43, 47, 67, 71, 73, 79, 101, 149, 173, 181, 211, 233, 347, 421, 443, 613, 641, 647, 673, 719, 727, 971, 1123, 1361, 1429, 1609, 1697, 2153, 2179, 3371, 3547, 3833, 4019, 4091, 4099, 4229, 5227, 5261, 5281, 5683, 5689, 5741, 5749, 5821
Offset: 1
101 written in base 9 is 122. The base-9 numbers 122, 221, 212 written in base 10 are 101, 181, 173, respectively and all those numbers are prime, so 101, 173 and 181 are terms of the sequence.
-
With[{b = 9}, Select[Prime@ Range[PrimePi@ b + 1, 10^3], Function[w, And[AllTrue[Array[FromDigits[RotateRight[w, #], b] &, Length@ w - 1], PrimeQ], Union@ w != {1} ]]@ IntegerDigits[#, b] &]] (* Michael De Vlieger, Dec 30 2017 *)
-
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, 9))!=vecmax(digits(p, 9)), if(is_circularprime(p, 9), print1(p, ", "))))
A317688
Absolute primes that are not repunits: primes where the number resulting from any permutation of the digits is also prime, excluding repunit primes.
Original entry on oeis.org
2, 3, 5, 7, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 199, 311, 337, 373, 733, 919, 991
Offset: 1
The other numbers resulting from all possible permutations of the digits of 113 are 131 and 311. 113, 131 and 311 are all primes, so all three numbers are terms of this sequence.
-
eva(n) = subst(Pol(n), x, 10)
find_index_a(vec) = my(r=#vec-1); while(1, if(vec[r] < vec[r+1], return(r)); r--; if(r==0, return(-1)))
find_index_b(r, vec) = my(s=#vec); while(1, if(vec[r] < vec[s], return(s)); s--; if(s==r, return(-1)))
switch_elements(vec, firstpos, secondpos) = my(g); g=vec[secondpos]; vec[secondpos]=vec[firstpos]; vec[firstpos] = g; vec
reverse_order(vec, r) = my(v=[], w=[]); for(x=1, r, v=concat(v, vec[x])); for(y=r+1, #vec, w=concat(w, vec[y])); w=Vecrev(w); concat(v, w)
next_permutation(vec) = my(r=find_index_a(vec)); if(r==-1, return(0), my(s=find_index_b(r, vec)); vec=switch_elements(vec, r, s); vec=reverse_order(vec, r)); vec
is(n) = if(n < 10, return(1)); my(d=vecsort(digits(n))); if(vecmin(d)==0 || vecmax(d)==1, return(0)); while(1, if(!ispseudoprime(eva(d)), return(0)); d=next_permutation(d); if(d==0, return(1)))
forprime(p=1, , if(is(p), print1(p, ", ")))
Showing 1-10 of 12 results.
Comments