A055387
2, 3, 5, 7, together with primes such that there is a nontrivial rearrangement of the digits which is a prime.
Original entry on oeis.org
2, 3, 5, 7, 13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 359, 367, 373, 379, 389, 397, 401, 419, 421
Offset: 1
A065074
Near-repunit primes that contain the digit 0.
Original entry on oeis.org
101, 10111, 101111, 11110111, 11111101, 101111111, 101111111111, 111011111111, 111111011111, 111111110111, 111111111101, 11111111101111111, 11111111111111101, 101111111111111111, 111110111111111111, 111111101111111111, 111111111111011111, 111111111111111011
Offset: 1
-
N:= 20: # to get all terms of up to N digits
A:= select(isprime,[seq(seq((10^n-1)/9 - 10^j,j=n-2..1,-1),n=3..N)]); # Robert Israel, Jun 23 2015
-
f[n_] := Block[{lst = {}, r = (10^(n - 1) - 1)/9}, AppendTo[ lst, Select[ FromDigits[ Permutations[ Append[ IntegerDigits@ r, 0]]], PrimeQ@# && # > 100 &]]; Union@ Flatten@ lst]; Array[f, 18] // Flatten (* Robert G. Wilson v, Jun 22 2015 *)
A107694
Primes with digital product = 8.
Original entry on oeis.org
181, 241, 421, 811, 1181, 1811, 2141, 2221, 2411, 4211, 8111, 21221, 141121, 142111, 411211, 1111181, 1112141, 1121221, 1211141, 1211411, 1212121, 2111411, 2121121, 2211211, 2221111, 2411111, 4121111, 4211111, 11221211, 12111221, 12121121
Offset: 1
Cf.
A004022,
A107612,
A107689,
A107690,
A107691,
A107692,
A107693,
A107695,
A107696,
A107697,
A107698.
-
[p: p in PrimesUpTo(3*10^7) | &*Intseq(p) eq 8]; // Vincenzo Librandi, Jul 27 2016
-
Union[ Flatten[ Table[ Select[ Sort[ FromDigits /@ Join[ Permutations[ Flatten[{8, Table[1, {n}]}]], Permutations[ Flatten[{2, 4, Table[1, {n - 1}]}]], Permutations[ Flatten[{2, 2, 2, Table[1, {n - 2}]}] ]]], PrimeQ[ # ] & ], {n, 0, 7}]]]
Select[Prime[Range[3 10^6]], Times@@IntegerDigits[#] == 8 &] (* Vincenzo Librandi, Jul 27 2016 *)
A107697
Primes with digital product = 12.
Original entry on oeis.org
43, 223, 431, 1223, 1621, 2161, 2213, 3221, 6121, 6211, 11261, 11621, 12161, 12611, 13411, 21611, 26111, 41113, 41131, 61121, 61211, 111143, 111341, 111431, 112213, 114113, 114311, 121123, 121321, 122131, 123121, 131221, 141131, 141311, 143111
Offset: 1
Cf.
A004022,
A107612,
A107689,
A107690,
A107691,
A107692,
A107693,
A107694,
A107695,
A107696,
A107698.
-
[p: p in PrimesUpTo(1000000) | &*Intseq(p) eq 12]; // Vincenzo Librandi, Jul 27 2016
-
Union[ Flatten[ Table[ Select[ Sort[ FromDigits /@ Join[ Permutations[ Flatten[{2, 6, Table[1, {n - 1}]}]], Permutations[ Flatten[{3, 4, Table[1, {n - 1}]}]], Permutations[ Flatten[{2, 2, 3, Table[1, {n - 2}]}] ]]], PrimeQ[ # ] & ], {n, 0, 5}]]]
Select[Prime[Range[75000]], Times@@IntegerDigits[#] == 12 &] (* Vincenzo Librandi, Jul 27 2016 *)
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
A030291
Primes with at most two different digits.
Original entry on oeis.org
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, 449, 499, 557, 577, 599, 661, 677, 727, 733
Offset: 1
-
Select[Range[1000], PrimeQ[#] && Length[Union[RealDigits[#][[1]]]] <= 2 &]
Select[Prime[Range[200]],Count[DigitCount[#],0]>7&] (* Harvey P. Dale, Jul 14 2017 *)
A034895
Dropping any digit gives a prime number.
Original entry on oeis.org
22, 23, 25, 27, 32, 33, 35, 37, 52, 53, 55, 57, 72, 73, 75, 77, 111, 113, 117, 119, 131, 137, 171, 173, 179, 197, 311, 317, 371, 411, 413, 417, 431, 437, 471, 473, 611, 617, 671, 711, 713, 719, 731, 1013, 1031, 1037, 1073, 1079, 1097, 1379, 1397, 1499, 1673
Offset: 1
1379 is in the sequence since 379, 179, 139 & 137 are all primes. - _Robert G. Wilson v_, Oct 07 2014
-
fQ[n_] := Union[ PrimeQ[ Table[ Quotient[n, 10^k]*10^(k - 1) + Mod[n, 10^(k - 1)], {k, 1 + Floor@ Log10@ n}] ]] == {True}; Select[ Range@ 1675, fQ] (* Robert G. Wilson v, Oct 07 2014 *)
ddpnQ[n_]:=With[{id=IntegerDigits[n]},AllTrue[Table[FromDigits[Drop[id,{i}]],{i,Length[id]}],PrimeQ]]; Select[Range[2000],ddpnQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Apr 12 2017 *)
-
isok(n) = {d = digits(n); for (i=1, #d, nd = []; for (k=1, #d, if (k != i, nd = concat(nd, d[k]));); if (! isprime(subst(Pol(nd), x, 10)), return (0));); return (1);} \\ Michel Marcus, Jul 17 2014
-
DroppingAnyDigitGivesAPrime(N,b) = {
\\ Property-testing function; returns 1 if true for N, 0 otherwise
\\ Works with any base b. Here usable with b=10.
my(k=b,m); if(N=(k\b), m=(N\k)*(k\b)+(N%(k\b));
if ((m<2)||(!isprime(m)),return(0)); k*=b);
return(1);
} \\ Stanislav Sykora, Jan 14 2016
-
from sympy import isprime
def is_A034895(n):
s = str(n)
return n>9 and all(isprime(int(s[:i]+s[i+1:])) for i in range(len(s)))
# David Radcliffe, Dec 11 2017
A258706
Absolute primes: every permutation of digits is a prime. Only the smallest representative of each permutation class is shown.
Original entry on oeis.org
2, 3, 5, 7, 11, 13, 17, 37, 79, 113, 199, 337, 1111111111111111111, 11111111111111111111111
Offset: 1
-
import Data.List (permutations, (\\))
a258706 n = a258706_list !! (n-1)
a258706_list = f a000040_list where
f ps'@(p:ps) | any (== 0) (map a010051' dps) = f ps
| otherwise = p : f (ps' \\ dps)
where dps = map read $ permutations $ show p
-- Reinhard Zumkeller, Jun 10 2015
-
Flatten@{2, 3, 5, 7,
Table[Select[
Table @@
Prepend[Prepend[
Table[{A@k, A[k - 1], 4}, {k, 2, n}], {A[1], 4}],
Unevaluated[
Unevaluated[FromDigits[{1, 3, 7, 9}[[A /@ Range[n]]]]]]] //
Flatten,
Function[L,
And[PrimeQ[#],
And @@ PrimeQ[
FromDigits /@ (Permute[L, #] & /@
RandomPermutation[Length@L, 5])],
And @@ PrimeQ[FromDigits /@ Rest[Permutations[L]]]]]@
IntegerDigits@# &], {n, 2, 33}]}
(* Exhaustively searches thru 33 digits in ~7.5 sec, and up to 69 digits in 5 min, but cannot reach 317 digits. Not helpful in the light of Schroeppel's theorem that it's all repunits past 991. - Bill Gosper, Jan 06 2017 *)
-
{A=[2,5]; for(n=1, 317, my(D=[1,3,7,9], r=10^n\9); for(a=1,4, for(b=a^(n<3),4, for(j=0, if(b!=a,n-1), ispseudoprime(D[a]*r+(D[b]-D[a])*10^j)||next(2)); A=setunion(A, [r*D[a]+(D[b]-D[a])*10^if(b=n[1] && #select(d->d,n[^1]-n[^-1])<2 && !for(i=1,(#n)^(n[#n]>1), isprime(fromdigits(n=concat(n[^1],n[1])))||return)} \\ By Johnson's theorem and minimality required here, the number must be of the form ab...b or a...ab (=> first difference of digits has at most 1 nonzero component) and then is sufficient to consider rotations of the digits.
\\ M. F. Hasler, Jun 26 2018
A039986
Primes such that every distinct permutation of digits is composite (including permutations with leading zeros).
Original entry on oeis.org
2, 3, 5, 7, 11, 19, 23, 29, 41, 43, 47, 53, 59, 61, 67, 83, 89, 151, 211, 223, 227, 229, 233, 257, 263, 269, 353, 383, 409, 431, 433, 443, 449, 487, 499, 523, 541, 557, 599, 661, 677, 773, 827, 829, 853, 859, 881, 883, 887, 929, 997, 1447, 1451, 1481, 2111
Offset: 1
-
t = {}; Do[p=Prime[n]; If[Length[Select[Table[FromDigits[k], {k,Permutations[IntegerDigits[p]]}], PrimeQ]] == 1, AppendTo[t,p]], {n,330}]; t (* Jayanta Basu, May 07 2013 *)
Select[Prime[Range[400]],AllTrue[FromDigits/@Rest[ Permutations[ IntegerDigits[#]]], CompositeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Nov 22 2015 *)
-
is(n,d=digits(n))={isprime(n)&&!for(i=1,(#d)!, (n=vecextract(d,numtoperm(#d,i)))!=d&& isprime(fromdigits(n))&& return)} \\ Then: select(is,primes(500)) - M. F. Hasler, Jun 28 2018
is(n)={isprime(n)||return; my(d=vecsort(digits(n), (a, b)->if(a-b&& t=bittest(650, a)-bittest(650, b),t,a-b)), p=vector(#d,i,i), N(p,i=2)= while((t=p[i]-1)&& while((setsearch(Set(p[i+1..#p]),t)|| d[t]==d[p[i]])&& t--,); !t, i++>#p&& return); i<#p|| bittest(650, d[t])|| return; concat([setminus(Set(p[1..i]),[t]), t, p[i+1..#p]]), t); #d==1|| !until(!p=N(p),(n!=t=fromdigits(vecextract(d,p)))&& isprime(t)&& return)} \\ Produces only inequivalent permutations which can be prime. - M. F. Hasler, Jun 28 2018
A039986_row(n)={if(n>1, local(D=eval(Vec("0245681379")), u=vectorv(n, i, 10^(n-i)), nextperm()=for(i=2,n,(t=p[i]-1)&& while(setsearch(Set(p[i+1..n]),t)|| d[t]==d[p[i]], t--||break); t|| next; iM. F. Hasler, Jul 01 2018
-
from itertools import count, islice, combinations_with_replacement
from sympy.utilities.iterables import multiset_permutations
from sympy import isprime
def A039986_gen(): # generator of terms
for l in count(1):
xlist = []
for p in combinations_with_replacement('0123456789',l):
flag = False
for q in multiset_permutations(p):
if isprime(m:=int(''.join(q))):
if flag or q[0]=='0':
flag = False
break
else:
flag = True
r = m
if flag:
xlist.append(r)
yield from sorted(xlist)
A039986_list = list(islice(A039986_gen(),30)) # Chai Wah Wu, Dec 26 2023
A260224
Primes having only {1, 3, 5} as digits.
Original entry on oeis.org
3, 5, 11, 13, 31, 53, 113, 131, 151, 311, 313, 331, 353, 1151, 1153, 1511, 1531, 1553, 3313, 3331, 3511, 3533, 5113, 5153, 5333, 5351, 5531, 11113, 11131, 11311, 11351, 11353, 11551, 13151, 13313, 13331, 13513, 13553, 15131, 15313, 15331, 15511, 15551
Offset: 1
Cf. similar sequences listed in
A260223.
-
[p: p in PrimesUpTo(40000) | Set(Intseq(p)) subset [3, 5, 1]];
-
Select[Prime[Range[3 10^3]], Complement[IntegerDigits[#], {3, 5, 1}]=={} &]
Select[Flatten[Table[FromDigits/@Tuples[{1,3,5},n],{n,5}]],PrimeQ] (* Harvey P. Dale, Mar 03 2020 *)
-
from gmpy2 import is_prime, mpz
from itertools import product
A260224_list = [int(''.join(x)) for n in range(1,10) for x in product('135',repeat=n) if is_prime(mpz(''.join(x)))] # Chai Wah Wu, Jul 21 2015
Comments