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
A344626
Primes p such that exactly two numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 127, 149, 157, 163, 173, 181, 191, 271, 277, 307, 313, 317, 331, 359, 367, 379, 397, 419, 479, 491, 571, 577, 593, 617, 631, 673, 701, 709, 727, 739, 757, 761, 787, 797, 811, 839, 877, 907, 911, 937, 941, 947, 977
Offset: 1
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==2, 1, 0)
forprime(p=1, 1e3, if(is(p), print1(p, ", ")))
A344627
Primes p such that exactly three numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
113, 131, 197, 199, 311, 337, 373, 719, 733, 919, 971, 991, 1031, 1091, 1097, 1103, 1109, 1123, 1181, 1213, 1231, 1279, 1297, 1301, 1319, 1327, 1579, 1777, 1811, 1873, 1913, 1949, 1951, 1979, 1987, 1993, 2131, 2311, 2377, 2399, 2713, 2791, 2939, 2971, 3011
Offset: 1
-
Select[Prime[Range[500]],Total[Boole[PrimeQ[FromDigits/@ Table[ RotateRight[ IntegerDigits[#],n],{n,IntegerLength[#]}]]]]==3&] (* Harvey P. Dale, Mar 30 2023 *)
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==3, 1, 0)
forprime(p=1, 1e3, if(is(p), print1(p, ", ")))
A344628
Primes p such that exactly four numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
1193, 1931, 3119, 3779, 7793, 7937, 9311, 9377, 11393, 11701, 11717, 11743, 13177, 13931, 13997, 16993, 17011, 17117, 17431, 17539, 17713, 19717, 19997, 21737, 23339, 23773, 30197, 31139, 31699, 31771, 32377, 33923, 37217, 38197, 39233, 39499, 39799, 39971
Offset: 1
-
Select[Prime[Range[4500]],Count[FromDigits/@Table[RotateRight[IntegerDigits[#],d],{d,IntegerLength[ #]}],?PrimeQ]==4&] (* _Harvey P. Dale, Aug 31 2024 *)
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==4, 1, 0)
forprime(p=1, 1e3, if(is(p), print1(p, ", ")))
A344629
Primes p such that exactly five numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
11939, 19391, 19937, 37199, 39119, 71993, 91193, 93719, 93911, 99371, 103391, 103997, 107119, 110339, 111893, 111919, 113123, 113177, 113983, 114997, 117133, 117319, 117353, 117701, 118931, 119107, 119179, 119191, 119699, 123113, 127733, 129919, 131231, 131771
Offset: 1
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==5, 1, 0)
forprime(p=1, 1e3, if(is(p), print1(p, ", ")))
A344630
Primes p such that exactly six numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
193939, 199933, 319993, 331999, 391939, 393919, 919393, 933199, 939193, 939391, 993319, 999331, 1313999, 1317727, 1399913, 1731893, 1743737, 1772713, 1893173, 1977779, 2713177, 3139991, 3173189, 3177271, 3189317, 3717437, 4373717, 7174373, 7271317, 7318931
Offset: 1
-
Select[Prime[Range[500000]],Total[Boole[PrimeQ[FromDigits/@Table[RotateRight[IntegerDigits[#],n],{n,0,IntegerLength[ #]-1}]]]]==6&] (* Harvey P. Dale, Sep 22 2024 *)
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==6, 1, 0)
forprime(p=1, 1e3, if(is(p), print1(p, ", ")))
A344631
Primes p such that exactly seven numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
17773937, 39371777, 71777393, 73937177, 77393717, 77739371, 93717773, 101717933, 101793137, 111766999, 111897767, 113379997, 113719261, 113773021, 113913133, 117669991, 118977671, 119307977, 119937137, 123975113, 131239751, 131331139, 131473193, 133113913
Offset: 1
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==7, 1, 0)
forprime(p=1, 1e3, if(is(p), print1(p, ", ")))
A344632
Primes p such that exactly eight numbers among all circular permutations of the digits of p are prime.
Original entry on oeis.org
119139133, 133119139, 139133119, 191391331, 311913913, 331191391, 913311913, 913913311, 1013517313, 1033939939, 1039191919, 1112795317, 1113194339, 1117923797, 1127953171, 1131943391, 1139937913, 1173917197, 1179237971, 1279531711, 1310135173, 1311399379
Offset: 1
-
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
eva(n) = subst(Pol(n), x, 10)
is(n) = my(r=rot(digits(n)), i=0); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); if(n==1 || n==11, return(0)); if(i==8, 1, 0)
forprime(p=1, , if(is(p), print1(p, ", ")))
A045978
Palindromic primes that are "near miss circular primes" (all cyclic shifts except one are primes).
Original entry on oeis.org
101, 181, 191, 313, 727, 757, 787, 797, 13931, 71317, 73237, 77977, 7791977
Offset: 0
-
NearCyclPrmsUpTo10powerK[k_]:= Union@Flatten[Table[ParallelMap[If[IntegerDigits[#]== Reverse@IntegerDigits[#] && (Count[FromDigits/@
NestList[RotateLeft, IntegerDigits[#], IntegerLength[#]-1], ?PrimeQ] ==IntegerLength[#]-1), #, Nothing]&, Select[FromDigits/@ Tuples[{1, 2, 3, 5, 7, 8, 9, 0}, n], PrimeQ]], {n, 3, k}], 1]; NearCyclPrmsUpTo10powerK[7] (* _Mikk Heidemaa, Apr 26 2017 *)
A286415
Primes p where all the cyclic shifts of their digits to the right also produce primes except the last one before reaching p again.
Original entry on oeis.org
19, 23, 29, 41, 43, 47, 53, 59, 61, 67, 83, 89, 173, 271, 277, 313, 379, 397, 419, 479, 491, 571, 577, 593, 617, 631, 673, 811, 839, 877, 911, 977, 1777, 1913, 2131, 2311, 2377, 2399, 2713, 2791, 2939, 2971, 4177, 4339, 4919, 4993, 5119, 5791, 6133, 6737, 6997, 7193, 7333, 7919, 8111
Offset: 1
2131 is a member as all the cyclic shifts of its digits to the right result in primes (1213, 3121) except the last one (1312) before reaching the original prime.
-
cyclDigs[k_]:= FromDigits/@ NestList[RotateRight, IntegerDigits[k], IntegerLength[k]-1]; rgtSftNearCircPrmsInBtw[m_, n_]:= ParallelMap[ If[AllTrue[Most[cyclDigs[#]], PrimeQ] && Not@ PrimeQ[Last[cyclDigs[#]]], #, Nothing] &, Prime @ Range[PrimePi[m], PrimePi[n]]];
rgtSftNearCircPrmsInBtw[19, 10^7]
cspQ[n_]:=Module[{t=PrimeQ[FromDigits/@Table[RotateRight[IntegerDigits[ n],k],{k,IntegerLength[n]-1}]]},Last[t]==False&&Union[Most[t]]=={True}]; Join[ {19,23,29,41,43,47,53,59,61,67,83,89},Select[ Prime[ Range[ 26,1100]],cspQ]] (* Harvey P. Dale, Oct 05 2020 *)
-
from itertools import product
from sympy import isprime
A286415_list = []
for l in range(1,15):
for d in '123456789':
for w in product('1379',repeat=l):
s = d+''.join(w)
n = int(s)
for i in range(l):
if not isprime(int(s)):
break
s = s[-1]+s[:-1]
else:
if not isprime(int(s)):
A286415_list.append(n) # Chai Wah Wu, May 21 2017
Showing 1-10 of 13 results.
Comments