Displaying 1-9 of 9 results found.
page
1
a(n+1) is next smallest prime beginning with a(n), initial prime is 2.
+10
13
2, 23, 233, 2333, 23333, 2333321, 233332117, 2333321173, 233332117313, 23333211731399, 2333321173139903, 2333321173139903173, 23333211731399031733, 2333321173139903173301, 2333321173139903173301021
MATHEMATICA
b = 10; s = {{2}};
Do[NestWhile[# + 1 &, 0, ! (PrimeQ[FromDigits[tmp = Join[Last[s], (nn = #;
IntegerDigits[nn - Sum[b^n, {n, l = NestWhile[# + 1 &, 1, ! (nn - (Sum[b^n, {n, #}]) < 0) &] - 1}], b, l + 1])], b]]) &]; AppendTo[s, tmp], {20}]; Map[FromDigits, s] (* Peter J. C. Moses, Aug 06 2015 *)
CROSSREFS
Similar to but different from A069603.
a(n+1) is next smallest prime beginning with a(n), initial prime is a(0) = 7.
+10
5
7, 71, 719, 7193, 71933, 719333, 71933317, 719333177, 71933317711, 7193331771103, 71933317711039, 7193331771103939, 719333177110393913, 7193331771103939133, 719333177110393913323, 71933317711039391332309, 719333177110393913323097, 719333177110393913323097047
MAPLE
f:= proc(n) option remember; local q, d, v;
q:=procname(n-1);
for d from 1 do
v:= nextprime(q*10^d);
if v < (q+1)*10^d then return v fi
od
end proc:
f(0):= 7:
MATHEMATICA
Nest[Function[{a, n}, Append[#, Catch@ Do[Do[If[PrimeQ@ #, Throw@ #; Break[], #] &@ FromDigits[n~Join~PadLeft[IntegerDigits[(5 j - 4 + Mod[3 j + 2, 4])/2], i]], {j, 4*10^(i - 1)}], {i, Infinity}]]] @@ {#, IntegerDigits[#[[-1]] ]} &, {7}, 17] (* Michael De Vlieger, Jan 26 2020 *)
PROG
(PARI)
next_ A048552(p)=for(i=1, oo, my(q=nextprime(p*=10)); q-p>10^i||return(q))
a(n+1) is the next smallest prime beginning with a(n), initial prime is 3.
+10
4
3, 31, 311, 3119, 31193, 3119309, 31193093, 311930933, 31193093317, 311930933179, 3119309331797, 311930933179703, 31193093317970371, 3119309331797037107, 311930933179703710759, 31193093317970371075907
MAPLE
f:= proc(n) local d, a;
for d from 1 do
for a from 10^d*n+1 by 2 to 10^d*(n+1) do
if isprime(a) then return a fi
od od
end proc:
R:= 3: x:= 3:
for i from 2 to 30 do
x:= f(x);
R:= R, x;
od:
Primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime, starting with 3.
+10
1
3, 31, 311, 3119, 31193, 3119317, 31193171, 311931713, 3119317139, 311931713939, 31193171393933, 3119317139393353, 31193171393933531, 3119317139393353121, 311931713939335312127, 311931713939335312127113, 31193171393933531212711399, 31193171393933531212711399123
COMMENTS
a(n + 1) is the next smallest prime beginning with a(n). Initial term is 3. These are the primes arising in A069605.
EXAMPLE
a(1) = 3 by definition.
a(2) is the next smallest prime beginning with 3, so a(2) = 31.
a(3) is the next smallest prime beginning with 31, so a(3) = 311.
MATHEMATICA
A069605[1] = 3; A236527[1] = 3; A069605[n_] := A069605[n] = Block[{k = 1, c = IntegerDigits @ Table[ a[i], {i, n - 1}]}, While[ !PrimeQ[ FromDigits[Flatten[Append[c, IntegerDigits[k]]]]], k += 2]; k]; A236527[n_] := A236527[n] = FromDigits[Flatten[IntegerDigits[ A236527[n - 1]], IntegerDigits[ A069605[n]]]]; Table[ A236527[n], {n, 20}] (* Alonso del Arte, Jan 28 2014 based on Robert G. Wilson v's program for A069605 *)
nxt[n_]:=Module[{s=1}, While[CompositeQ[n*10^IntegerLength[s]+s], s+=2]; n*10^IntegerLength[s]+s]; NestList[nxt, 3, 20] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 22 2020 *)
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
..num = str(x)
..n = 1
..while n < 10**3:
....new_num = str(x) + str(n)
....if isprime(int(new_num)):
......print(int(new_num))
......x = new_num
......n = 1
....else:
......n += 1
b(3)
Start with 9; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.
+10
1
9, 97, 971, 9719, 971917, 97191713, 9719171333, 971917133323, 9719171333237, 971917133323777, 97191713332377731, 9719171333237773159, 971917133323777315951, 97191713332377731595127, 971917133323777315951277, 971917133323777315951277269
COMMENTS
a(n+1) is the next smallest prime beginning with a(n). Initial term is 9. After a(1), these are the primes in A069611.
EXAMPLE
a(1) = 9 by definition.
a(2) is the next smallest prime beginning with 9, so a(2) = 97.
a(3) is the next smallest prime beginning with 97, so a(3) = 971.
MAPLE
R:= 9: x:= 9:
for i from 2 to 20 do
for y from 1 by 2 do
z:= x*10^(1+ilog10(y)) + y;
if isprime(z) then
R:= R, z; x:= z; break
fi
od od:
MATHEMATICA
next[p_]:=Module[{i=1, q}, While[!PrimeQ[q=10^IntegerLength[i]p+i], i+=2]; q];
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
num = str(x)
n = 1
while n < 10**3:
new_num = str(x) + str(n)
if isprime(int(new_num)):
print(int(new_num))
x = new_num
n = 1
else:
n += 1
b(9)
Start with 4; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.
+10
0
4, 41, 419, 41911, 4191119, 41911193, 419111933, 41911193341, 4191119334151, 419111933415151, 41911193341515187, 4191119334151518719, 419111933415151871963, 41911193341515187196323, 4191119334151518719632313, 419111933415151871963231329
COMMENTS
a(n+1) is the next smallest prime beginning with a(n). Initial term is 4.
After a(1), these are the primes arising in A069606.
EXAMPLE
a(1) = 4 by definition.
a(2) is the next smallest prime beginning with 4, so a(2) = 41.
a(3) is the next smallest prime beginning with 41, so a(3) = 419.
...and so on.
MATHEMATICA
NestList[Module[{k=1}, While[!PrimeQ[#*10^IntegerLength[k]+k], k+=2]; #*10^IntegerLength[k]+ k]&, 4, 20] (* Harvey P. Dale, Jul 20 2024 *)
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
..num = str(x)
..n = 1
..while n < 10**3:
....new_num = str(x) + str(n)
....if isprime(int(new_num)):
......print(int(new_num))
......x = new_num
......n = 1
....else:
......n += 1
b(4)
5, 53, 5323, 53231, 532313, 5323139, 532313921, 5323139219, 532313921921, 53231392192123, 5323139219212343, 53231392192123433, 5323139219212343323, 53231392192123433237, 5323139219212343323721, 532313921921234332372189, 53231392192123433237218937, 5323139219212343323721893721
COMMENTS
a(n+1) is the next smallest prime beginning with a(n). Initial term is 5.
EXAMPLE
a(1) = 5.
a(2) is the next smallest prime that begins with 5, so a(2) = 53.
a(3) is the next smallest prime that begins with 53, so a(3) = 5323.
...and so on.
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
..num = str(x)
..n = 1
..while n < 10**3:
....new_num = str(x) + str(n)
....if isprime(int(new_num)):
......print(int(new_num))
......x = new_num
......n = 1
....else:
......n += 1
b(5)
Start with 6; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.
+10
0
6, 61, 613, 6131, 613141, 61314119, 6131411917, 61314119171, 6131411917181, 613141191718127, 61314119171812789, 613141191718127893, 61314119171812789379, 6131411917181278937929, 61314119171812789379291, 61314119171812789379291111
COMMENTS
a(n+1) is the next smallest prime beginning with a(n). Initial term is 6. After a(1), these are the primes arising in A069608.
EXAMPLE
a(1) = 6 by definition.
a(2) is the next smallest prime beginning with 6, so a(2) = 61.
a(3) is the next smallest prime beginning with 61, so a(3) = 613.
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
..num = str(x)
..n = 1
..while n < 10**3:
....new_num = str(x) + str(n)
....if isprime(int(new_num)):
......print(int(new_num))
......x = new_num
......n = 1
....else:
......n += 1
b(6)
Start with 8; thereafter, primes obtained by concatenating to the end of previous term the next smallest number that will produce a prime.
+10
0
8, 83, 839, 83911, 839117, 83911721, 8391172123, 83911721233, 839117212337, 83911721233729, 839117212337293, 83911721233729399, 839117212337293999, 83911721233729399993, 839117212337293999931, 83911721233729399993139
COMMENTS
a(n+1) is the next smallest prime beginning with a(n). Initial term is 8. After a(1), these are the primes arising in A069610.
EXAMPLE
a(1) = 8 by definition.
a(2) is the next smallest prime beginning with 8, so a(2) = 83.
a(3) is the next smallest prime beginning with 83, so a(3) = 839.
MATHEMATICA
smp[n_]:=Module[{k=1}, While[!PrimeQ[n*10^IntegerLength[k]+k], k++]; n 10^IntegerLength[k]+ k]; NestList[smp, 8, 15] (* Harvey P. Dale, Aug 10 2024 *)
PROG
(Python)
import sympy
from sympy import isprime
def b(x):
..num = str(x)
..n = 1
..while n < 10**3:
....new_num = str(x) + str(n)
....if isprime(int(new_num)):
......print(int(new_num))
......x = new_num
......n = 1
....else:
......n += 1
b(8)
Search completed in 0.032 seconds
|