Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Search: a158594 -id:a158594
     Sort: relevance | references | number | modified | created      Format: long | short | data
a(n) is the smallest n-digit prime term of A158594 and zero if there is no such number.
+20
5
7, 11, 271, 1033, 18289, 133733, 1045493, 11939237, 103333333, 1342313221, 10300335833, 145933933339, 1332523411733, 11653733331833
OFFSET
1,1
COMMENTS
It seems that for all n, a(n)>0.
A164327(n) gives us smallest n-digit term of A158594. So A164328(n)>=A164327(n).
EXAMPLE
a(5)=18289 so all the seven numbers 18289, 318289, 138289, 183289, 182389,
182839 & 182893 are primes.
MATHEMATICA
pp[n_, k_] := Catch[Block[{d = IntegerDigits@n}, Do[If[! PrimeQ[ FromDigits[ Insert[d, k, i]]], Throw[False]], {i, 1+Length@d}]; True]]; a[n_] := Catch[ Block[{p = NextPrime[10^(n-1)]}, While[p < 10^n, If[pp[p, 3], Throw@p, p = NextPrime@p]]; 0]]; a /@ Range[8] (* Giovanni Resta, Aug 13 2013 *)
CROSSREFS
KEYWORD
base,hard,more,nonn
AUTHOR
Farideh Firoozbakht, Sep 22 2009
EXTENSIONS
a(11)-a(13) from Donovan Johnson, Apr 14 2010
a(14) from Giovanni Resta, Aug 11 2013
STATUS
approved
a(n) is the smallest n-digit term of A158594 and zero if there is no such number.
+20
1
1, 11, 121, 1033, 10423, 131329, 1039843, 11939237, 103333333, 1137333347, 10300335833, 101393333923, 1023239337799
OFFSET
1,2
COMMENTS
It seems that for all n, a(n)>0.
A164328(n) gives us smallest n-digit prime term of A158594.
CROSSREFS
KEYWORD
base,hard,more,nonn
AUTHOR
Farideh Firoozbakht, Sep 22 2009
EXTENSIONS
a(11)-a(13) from Donovan Johnson, Apr 14 2010
STATUS
approved
Numbers which yield a prime whenever a zero is inserted between any two digits.
+10
13
11, 13, 17, 19, 37, 41, 49, 53, 59, 61, 67, 71, 79, 89, 97, 109, 113, 119, 121, 131, 133, 149, 161, 169, 191, 197, 203, 227, 239, 253, 269, 281, 283, 299, 301, 319, 323, 337, 367, 379, 383, 401, 403, 407, 421, 449, 457, 473, 493, 499, 503, 509, 511, 539, 551
OFFSET
1,1
COMMENTS
Single-digit numbers 0, ..., 9 seem to be excluded but would satisfy the condition voidly. - M. F. Hasler, May 10 2018
LINKS
EXAMPLE
998471 is in the sequence because all the five numbers 9098471, 9908471, 9980471, 9984071 and 9984701 are primes.
MATHEMATICA
f[n_]:=(r=IntegerDigits[n]; l=Length[r]; For[k=2, PrimeQ[FromDigits[Insert
[r, 0, k]]], k++ ]; If[k==l+1, n, 0]); Select[Range[11, 560], f[ # ]>0&]
PROG
(PARI) is(n, L=logint(n+!n, 10)+1, P)={!for(k=1, L-1, isprime([10*P=10^(L-k), 1]*divrem(n, P))||return) && n>9} \\ M. F. Hasler, May 10 2018
CROSSREFS
Cf. A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
KEYWORD
base,easy,nonn
AUTHOR
Farideh Firoozbakht, Sep 22 2009
EXTENSIONS
Erroneous comment and cross-references deleted by M. F. Hasler, May 10 2018
STATUS
approved
Prefixing, suffixing or inserting a 9 in the number anywhere gives a prime.
+10
9
7, 19, 37, 41, 91, 199, 209, 239, 311, 539, 587, 661, 749, 923, 931, 941, 967, 1009, 1079, 1139, 1997, 2717, 2959, 3971, 3979, 4559, 4993, 4999, 5393, 5629, 5651, 6401, 6739, 6911, 8213, 8491, 8939, 9109, 9397, 9607, 9679, 9829, 11089, 11227, 13943
OFFSET
1,1
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..2128 (terms < 10^13, first 1175 terms from Chai Wah Wu)
PROG
(PARI) is(n, L=logint(n+!n, 10)+1, d, P)={!for(k=0, L, isprime((d=divrem(n, P=10^(L-k)))[2]+(10*d[1]+9)*P)||return)} \\ M. F. Hasler, May 10 2018
CROSSREFS
Cf. A215421 (subsequence of primes).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A158232 (13 is prefixed or appended).
Cf. A164329 (0 is inserted), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, Apr 14 2002
EXTENSIONS
More terms from Vladeta Jovovic, Apr 16 2002
Corrected offset by Chai Wah Wu, Oct 10 2019
STATUS
approved
Numbers that yield a prime when prime(k) is inserted after the k-th digit, for any k >= 1, k < number of digits.
+10
6
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 23, 27, 29, 41, 51, 53, 77, 81, 83, 87, 89, 99, 101, 149, 191, 239, 251, 287, 317, 353, 359, 419, 473, 497, 509, 527, 533, 611, 677, 743, 797, 809, 821, 887, 893, 941, 983, 1037, 1043, 1277, 1421, 1841, 1853, 1973, 1979, 2543
OFFSET
1,3
COMMENTS
The primes to insert are: 2 (after the first digit), 3 (after the second digit, if there are at least three), etc.
Inspired by A304243 and analog sequences given in cross-references.
The sequence is finite: if insertion of 3 after the second digit yields a prime, then the sum of digits must be congruent to 1 or 2 (mod 3). However, insertion of 2 after the first digit also must yield a prime, so only the second case is possible. But then, insertion of a digit 7 cannot yield a prime, so no term can have 5 digits or more. (Sequence A304243 circumvents this restriction by excluding 3 from the primes to insert, but it is still finite for a similar reason occurring later.)
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..100 (complete sequence).
EXAMPLE
The 1-digit numbers 0..9 are included since the condition is voidly satisfied: Nothing can be inserted, therefore each of the resulting numbers is prime.
17 is in the sequence because 127 is prime.
101 is in the sequence because 1201 and 1031 are prime.
PROG
(PARI) is(n, L=logint(n+!n, 10)+1, d, p, P)={!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10^logint(10*p=prime(k), 10)*d[1]+p)*P)|| return)}
CROSSREFS
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
Cf. A164329 (0 is inserted), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
KEYWORD
nonn,base,fini,full
AUTHOR
M. F. Hasler, May 21 2018
STATUS
approved
Numbers that yield a prime when prime(k+2) is inserted after the k-th digit (or prime(1) = 2 before the 1st digit for k=0), for 0 <= k <= number of digits.
+10
5
27, 33, 39, 57, 93, 333, 3747, 5073, 5997, 7239, 10053, 22419, 349731, 425991, 714807, 1719279, 81453303, 406253439, 481683189, 886662423, 2653294371
OFFSET
1,1
COMMENTS
The primes to insert are 2 (in front) or 5, 7, 11, 13, ... after the number's first, second, third, ... digit. So there cannot be any 1 digit solution because if 5 is appended this cannot yield a prime. One can show that the terms cannot have more than 21 digits.
The prime 3 is excluded from the strings to insert, because else no term could have more than 2 digits: to be prime with 2 prefixed or with 3 inserted, the number must be congruent to 2 (mod 3), so it cannot be prime with 7 appended or inserted. See also the Rivera link and A304244.
LINKS
Carlos Rivera, Puzzle 791. Interesting consecutive primes, The Prime Puzzles & Problems Connection.
EXAMPLE
a(1) = 27 because 2|27 = 227, 2|5|7 = 257 and 27|7 = 277 are all prime.
Similarly for a(6) = 333, because 2333, 3533, 3373 and 33311 are all prime.
PROG
(PARI) is(n, L=logint(n+!n, 10)+1, d, p, P)={isprime(n+2*10^L) && !for(k=1, L, isprime((d=divrem(n, P=10^(L-k)))[2]+(10^logint(10*p=prime(2+k), 10)*d[1]+p)*P)|| return)}
CROSSREFS
Cf. A304244 (prime(k) is inserted after the k-th digit), A304245 (2 is inserted after the first digit, or prime(k+1) is inserted after the k-th digit for k > 1).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
Cf. A164329 (0 is inserted), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
KEYWORD
nonn,base,fini
AUTHOR
M. F. Hasler, May 10 2018
STATUS
approved
Numbers that yield a prime when '2' is inserted between the first and second digit, or prime(k+1) is inserted after the k-th digit for any k > 1, k < number of digits.
+10
5
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 23, 27, 29, 41, 51, 53, 77, 81, 83, 87, 89, 99, 101, 113, 129, 149, 159, 179, 191, 203, 213, 221, 237, 251, 267, 269, 273, 281, 287, 293, 297, 321, 329, 357, 359, 401, 417, 419, 429, 441, 461, 471, 497, 509, 531, 561, 581, 603, 611, 663, 669, 687, 699, 707, 711
OFFSET
1,3
COMMENTS
The primes to be inserted are: 2 between 1st and 2nd digit, or 5 between 2nd and 3rd digit, or 7 between 3rd and 4th digit, etc.
The prime 3 is excluded because it would restrict the terms to have no more than 4 digits; see A304244 and the Rivera link in A304243.
The two terms 27 and 87 are the only numbers (with more than one digit) for which 2, 5 or 7 can be inserted between any two digits to yield a prime: all of 227, 257, 277, 827, 857 an 877 are prime. There is no other such number with more than 2 digits.
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..348 (all terms < 10^7).
EXAMPLE
The 1-digit numbers 0..9 are included since the condition is voidly satisfied: nothing can be inserted, therefore each of the resulting numbers is prime.
17 is in the sequence because 127 is prime.
101 is in the sequence because 1201 and 1051 are prime.
PROG
(PARI) is(n, L=logint(n+!n, 10)+1, d, p, P)={!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10^logint(10*p=prime(k+(k>1)), 10)*d[1]+p)*P)|| return)}
CROSSREFS
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) is inserted after the k-th digit) .
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
Cf. A164329 (0 is inserted), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
KEYWORD
nonn,base,fini
AUTHOR
M. F. Hasler, May 21 2018
STATUS
approved
Numbers that yield a prime whenever a '1' is inserted between any two digits.
+10
3
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 21, 31, 33, 37, 49, 63, 67, 69, 79, 81, 91, 99, 103, 109, 117, 123, 151, 163, 181, 193, 211, 213, 231, 241, 279, 309, 319, 363, 367, 391, 411, 427, 429, 453, 457, 459, 501, 513, 519, 547, 571, 601, 613, 621, 631, 697, 703, 709, 721, 729, 777, 787, 801, 811, 817, 879, 903, 951, 981, 987
OFFSET
1,3
COMMENTS
The single-digit terms voidly satisfy the condition: no '1' can be inserted anywhere, so all possible insertions yield a prime.
Motivated by sequence A164329 which is the analog for inserting 0.
Compare to A068673 where 1 is prefixed or appended, and to A068679 where 1 is prefixed, appended or inserted anywhere - which is therefore the intersection between this sequence and A068673.
See also A050711 where 1 is inserted between all adjacent digits. - R. J. Mathar, Feb 28 2020
EXAMPLE
21 is in the sequence, because if '1' is inserted between "any" pair consecutive digits (the only possibility being to insert it between the first and second digit, which yields 211), the result is always prime. The definition does not require the term itself to be prime.
103 is in the sequence because inserting 1 between the first and second, or between the second and third digit, would yield 1103 or 1013, respectively, which are both prime.
MAPLE
filter:= proc(n) local j, t;
for j from 1 to ilog10(n) do
if not isprime(10*n-9*(n mod 10^j)+10^j) then return false fi
od;
true
end proc:
select(filter, [$0..1000]); # Robert Israel, Jun 01 2018
PROG
(PARI) is(n)=!for(k=1, logint(n+!n, 10), isprime(10*n-n%10^k*9+10^k)||return)
(Magma) [0] cat [k:k in [1..1000]| forall{i:i in [1..#Intseq(k)-1]| IsPrime(Seqint(Reverse(v[1..i] cat [1] cat v[i+1..#v]))) where v is Reverse(Intseq(k)) }]; // Marius A. Burtea, Feb 09 2020
CROSSREFS
Cf. A164329 (prime when 0 is inserted anywhere), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (prime when 0 is inserted between all digits).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) is inserted after the k-th digit), A304245 (prime(k+1) is inserted after the k-th digit, k > 1, or '2' after the first digit).
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Jun 01 2018
STATUS
approved
Numbers which yield a prime whenever a '2' is inserted between any single pair of adjacent digits.
+10
3
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 23, 27, 29, 41, 51, 53, 77, 81, 83, 87, 89, 99, 101, 113, 123, 129, 131, 137, 149, 183, 207, 221, 243, 251, 297, 303, 321, 329, 357, 359, 399, 401, 417, 419, 429, 441, 443, 453, 461, 471, 473, 527, 533, 581, 597, 611, 621
OFFSET
1,3
COMMENTS
Motivated by existing sequences defined in an analog way for other digits to be inserted, e.g., A164329 for the digit 0, cf. cross-references.
For single-digit terms, the condition is voidly satisfied: nothing can be inserted.
See also A050712 where 2 is inserted between each pair of adjacent digits. - R. J. Mathar, Feb 28 2020
EXAMPLE
123 is in the sequence because it yields a prime when a '2' is inserted after the first or after the second digit, which yields the prime 1223 in both cases. The term itself does not need to be prime.
MAPLE
filter:= proc(n) local j, t;
for j from 1 to ilog10(n) do
if not isprime(10*n-9*(n mod 10^j)+2*10^j) then return false fi
od;
true
end proc:
select(filter, [$0..10000]); # Robert Israel, Jun 01 2018
PROG
(PARI) is(n, p=2, L=logint(n+!n, 10)+1, d, P)=!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10*d[1]+p)*P)||return)
CROSSREFS
Cf. A164329 (prime when 0 is inserted anywhere), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended), A304246 (1 is inserted anywhere).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) is inserted after the k-th digit), A304245 (prime(k+1) is inserted after the k-th digit, k > 1, or '2' after the first digit).
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Jun 01 2018
STATUS
approved
Numbers that yield a prime whenever a '3' is inserted between any two digits.
+10
2
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 17, 19, 23, 29, 31, 37, 41, 43, 49, 61, 73, 79, 89, 97, 101, 103, 121, 127, 167, 173, 181, 209, 211, 233, 239, 247, 251, 271, 283, 299, 307, 331, 343, 359, 361, 373, 391, 437, 439, 473, 491, 497, 509, 523, 533, 547, 551, 599
OFFSET
1,3
COMMENTS
Motivated by existing sequences defined in a similar way for other digits (e.g., A164329 for digit 0), subsequence A158594 = intersection of this and A068674 ('3' is prefixed or appended), and others: cf. cross-references.
EXAMPLE
121 is in the sequence because it yields a prime when a digit 3 is inserted after the first or after the second digit, which yields the prime 1321 or 1231, respectively. The term itself does not need to be prime.
The single-digit numbers 0..9 are in the sequence because they satisfy the condition voidly: nothing can be inserted, so no insertion yields a nonprime, so all possible insertions always yield a prime.
MATHEMATICA
Select[Range[0, 600], AllTrue[FromDigits/@Table[Insert[IntegerDigits[#], 3, n], {n, 2, IntegerLength[ #]}], PrimeQ]&] (* Harvey P. Dale, Nov 06 2022 *)
PROG
(PARI) is(n, p=3, L=logint(n+!n, 10)+1, d, P)=!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10*d[1]+p)*P)||return)
(Magma) [0] cat [k:k in [1..600]| forall{i:i in [1..#Intseq(k)-1]| IsPrime(Seqint(Reverse(v[1..i] cat [3] cat v[i+1..#v]))) where v is Reverse(Intseq(k))}]; // Marius A. Burtea, Feb 09 2020
CROSSREFS
Cf. A164329 (prime when 0 is inserted anywhere), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (prime when 0 is inserted between all digits).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended), A304246 (1 is inserted anywhere).
Cf. A304247 (2 is inserted anywhere).
Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these), A068674 (3 is prefixed or appended).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
Cf. A158232 (13 is prefixed or appended).
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) is inserted after the k-th digit), A304245 (prime(k+1) is inserted after the k-th digit, k > 1, or '2' after the first digit).
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Jun 01 2018
STATUS
approved

Search completed in 0.012 seconds