[go: up one dir, main page]

login
Search: a228325 -id:a228325
     Sort: relevance | references | number | modified | created      Format: long | short | data
Smallest number (not beginning with 0) that yields a prime when placed on the right of n.
+10
11
1, 3, 1, 1, 3, 1, 1, 3, 7, 1, 3, 7, 1, 9, 1, 3, 3, 1, 1, 11, 1, 3, 3, 1, 1, 3, 1, 1, 3, 7, 1, 17, 1, 7, 3, 7, 3, 3, 7, 1, 9, 1, 1, 3, 7, 1, 9, 7, 1, 3, 13, 1, 23, 1, 7, 3, 1, 7, 3, 1, 3, 11, 1, 1, 3, 1, 3, 3, 1, 1, 9, 7, 3, 3, 1, 1, 3, 7, 7, 9, 1, 1, 9, 19, 3, 3, 7, 1, 23, 7, 1, 9, 7, 1, 3, 7, 1, 3, 1, 9, 3, 1
OFFSET
1,2
COMMENTS
Max Alekseyev (see link) shows that a(n) always exists. Note that although his argument makes use of some potentially large constants (see the comments in A060199), the proof shows that a(n) exists for all n. - N. J. A. Sloane, Nov 13 2020
Many numbers become prime by appending a one-digit odd number. Some numbers (such as 20, 32, 51, etc.) require a 2-digit odd number (A032352 has these). In the first 100000 values of n there are only 22 that require a 3-digit odd number (A091089). There probably are some values that require odd numbers of 4 or more digits, but these are likely to be very large. - Chuck Seggelin (barkeep(AT)plastereddragon.com), Dec 18 2003
EXAMPLE
a(20)=11 because 11 is the minimum odd number which when appended to 20 forms a prime (201, 203, 205, 207, 209 are all nonprime, 2011 is prime).
MATHEMATICA
d[n_]:=IntegerDigits[n]; t={}; Do[k=1; While[!PrimeQ[FromDigits[Join[d[n], d[k]]]], k++]; AppendTo[t, k], {n, 102}]; t (* Jayanta Basu, May 21 2013 *)
mon[n_]:=Module[{k=1}, While[!PrimeQ[n*10^IntegerLength[k]+k], k+=2]; k]; Array[mon, 110] (* Harvey P. Dale, Aug 13 2018 *)
PROG
(PARI) A068695=n->for(i=1, 9e9, ispseudoprime(eval(Str(n, i)))&&return(i)) \\ M. F. Hasler, Oct 29 2013
(Python)
from sympy import isprime
from itertools import count
def a(n): return next(k for k in count(1) if isprime(int(str(n)+str(k))))
print([a(n) for n in range(1, 103)]) # Michael S. Branicky, Oct 18 2022
CROSSREFS
Cf. A032352 (a(n) requires at least a 2 digit odd number), A091089 (a(n) requires at least a 3 digit odd number).
Cf. also A060199, A228325, A336893.
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy, Mar 03 2002
EXTENSIONS
More terms from Chuck Seggelin (barkeep(AT)plastereddragon.com), Dec 18 2003
Entry revised by N. J. A. Sloane, Feb 20 2006
More terms from David Wasserman, Feb 14 2006
STATUS
approved
a(1)=1; thereafter a(n) is the smallest number m not yet in the sequence such that at least one of the concatenations a(n-1)||m or m||a(n-1) is prime.
+10
6
1, 3, 2, 9, 5, 21, 4, 7, 6, 13, 10, 19, 16, 27, 8, 11, 15, 23, 12, 17, 20, 29, 14, 33, 26, 47, 18, 31, 25, 39, 22, 37, 24, 41, 30, 49, 34, 57, 28, 43, 36, 59, 32, 51, 38, 53, 42, 61, 45, 67, 58, 69, 55, 63, 44, 81, 35, 71, 48, 77, 50, 87, 62, 99, 40, 73, 46
OFFSET
1,2
COMMENTS
Does every number appear in the sequence?
If a(n) is coprime to 10, then a(n+1) exists by Dirichlet's theorem. - Eric M. Schmidt, Aug 20 2013 [In more detail: let a(n) have d digits, and consider the arithmetic progression k*10^d + a(n), and apply Dirichlet's theorem. This gives a number k such that the concatenation k||a(n) is prime. N. J. A. Sloane, Nov 08 2020]
The argument in A068695 shows that a(n) always exists. - N. J. A. Sloane, Nov 11 2020
LINKS
Eric Angelini, Primes by concatenation, Posting to the Sequence Fans Mailing List, Aug 14 2013.
Michael De Vlieger, Labeled log-log scatterplot of a(n) n = 1..2^14, showing m coprime to 10 in red, otherwise dark blue.
MATHEMATICA
f[s_] := Block[{k = 2, idj = IntegerDigits@ s[[-1]]}, While[idk = IntegerDigits@ k; MemberQ[s, k] || ( !PrimeQ@ FromDigits@ Join[idj, idk] && !PrimeQ@ FromDigits@ Join[idk, idj]), k++]; Append[s, k]]; Nest[f, {1}, 66] (* Robert G. Wilson v, Aug 20 2013 *)
PROG
(Python)
from sympy import isprime
from itertools import islice
def c(s, t): return isprime(int(s+t)) or isprime(int(t+s))
def agen():
aset, k, mink = set(), 1, 2
while True:
an = k; aset.add(an); yield an; s, k = str(an), mink
while k in aset or not c(s, str(k)): k += 1
while mink in aset: mink += 1
print(list(islice(agen(), 56))) # Michael S. Branicky, Oct 17 2022
CROSSREFS
See A228324 for the primes that arise.
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Aug 20 2013
EXTENSIONS
More terms from Alois P. Heinz, Aug 20 2013
STATUS
approved
a(n) = smallest positive number k with all digits equal such that the concatenation k||n||k is prime, or -1 if no such k exists.
+10
2
1, 3, 7, 1, 11, 1, 7777, 3, 1, 1, 9, -1, 7, 33, 99, 1, 3, 1, 1, 9, 1, 11, -1, 1, 7, 3, 7777777777, 1111, 111, 1, 1, 3, 1, -1, 3, 33, 1, 3, 1, 77777777777777, 111, 3, 1111111111111111111111111111111111111111, 3, -1, 1, 3, 1, 1, 999, 7, 1, 11, 1, 7, -1, 33, 1, 3, 3, 1, 3, 1
OFFSET
0,2
COMMENTS
See A090287 for more information.
From Robert Price, Sep 20 2023: (Start)
For a(366), k is a string of 8441 1's.
The sequence then continues: 77, 1, 1, 3, 1, 1, 9, 7777777, 1, 11, 3, 1, 11, 9, 77, 11111, 1, 1, 33333, 3, 7, 9, 3, 1, 77, 1, 1, 9, 7777777777 until a(396) where k is a sequence of 269 1's.
The sequence then continues: 9, 777, 11, 9, 1, 7, 3, 7, 1, 11, 1, 1, 9, 9, 1111, 3, 999, 77777, 99, 7, 7, 3, 7, -1, 3, 1, 11, 77, 1, 77, 3, 1, 7, 3, 3, 1, 111111, 1, 7, 99, 7, 1111, 9, 1, 1, 11, 1, 7777777, 11, 1, 1111, 3, 1111, 7, 3, 7, 11, 3, 1, 1, 111, 3, 1, 3, 3, 1, 33, 9, 11, 33, 3, 7, 3, 3, 7, 99, 1, 1, 11, 3, 1, 9, 7, 77, 9, 1, 1, 3, 1, 7777, 33, 3, 1, 33, 3, 77, 77, 9, 1, 3, 33, 11111, 9, 9. (End)
EXAMPLE
a(3) = 1 because 131 is prime.
a(4) = 11 because 11411 is prime, and all of 141, 242, 343, ..., 949 are composite.
CROSSREFS
Cf. A090287.
Related sequences: A010785, A068695, A091088, A228323, A228325, A336893, A338712 (see also the Index link above).
KEYWORD
sign,base
AUTHOR
N. J. A. Sloane, Nov 08 2020
EXTENSIONS
More terms from Alois P. Heinz, Nov 08 2020
STATUS
approved
Least number k >= 0 such that n concatenated with n + k is prime.
+10
1
0, 1, 4, 3, 4, 1, 2, 1, 2, 3, 6, 1, 6, 9, 8, 3, 4, 5, 12, 7, 8, 15, 10, 13, 6, 7, 2, 5, 10, 7, 6, 19, 10, 15, 4, 1, 2, 9, 4, 9, 12, 1, 6, 3, 2, 3, 4, 13, 2, 1, 2, 9, 28, 17, 2, 1, 22, 3, 22, 7, 2, 1, 4, 5, 4, 7, 12, 1, 2, 9, 6, 11, 20, 3, 2, 5, 12, 1, 14, 1, 10, 5, 4, 37, 12, 3, 16, 5, 10
OFFSET
1,3
LINKS
FORMULA
a(n) = A228325(n) - n for n > 1.
EXAMPLE
33 is not prime. 34 is not prime. 35 is not prime. 36 is not prime. 37 is prime. Since 7 is 4 more than 3, a(3) = 4.
MAPLE
a:= proc(n) local j; for j from n do if isprime(n*10^(1+ilog10(j))+j) then return(j-n) fi od end proc:
seq(a(n), n=1..100); # Robert Israel, Jul 30 2014
MATHEMATICA
lnk[n_]:=Module[{k=0, idn=IntegerDigits[n]}, While[!PrimeQ[FromDigits[ Join[ idn, IntegerDigits[ n+k]]]], k++]; k]; Array[lnk, 90] (* Harvey P. Dale, Oct 05 2014 *)
PROG
(PARI)
a(n) = for(k=n, 10^4, if(isprime(eval(concat(Str(n), Str(k)))), return(k-n)))
vector(150, n, a(n))
(Python)
def a(n):
..for k in range(n, 10**4):
....if isprime(str(n)+str(k)):
......return k-n
n = 1
while n < 150:
..print(a(n), end=', ')
..n += 1
CROSSREFS
Cf. A228325.
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jul 30 2014
STATUS
approved

Search completed in 0.006 seconds