login
A354386
a(n) is the first prime that is the start of a sequence of exactly n primes under the map p -> p + A001414(p-1) + A001414(p+1).
0
3, 2, 337, 2633, 14143, 6108437, 373777931
OFFSET
1,1
EXAMPLE
a(3) = 337 because 337, 337+A001414(336)+A001414(338) = 383, and 383+A001414(382)+A001414(384) = 593 are prime, but 593+A001414(592)+A001414(594) = 660 is not prime, and 337 is the first prime for which this works.
MAPLE
spf:= proc(n) option remember; local t; add(t[1]*t[2], t=ifactors(n)[2]) end proc:
f:= n -> spf(n-1)+n+spf(n+1):
g:= proc(n) option remember;
if not isprime(n) then return 0 fi;
1 + procname(f(n))
end proc:
V:= Vector(7): count:= 0:
p:= 1:
while count < 7 do
p:= nextprime(p);
v:= g(p);
if V[v] = 0 then V[v]:= p; count:= count+1 fi;
od:
convert(V, list);
MATHEMATICA
f[1] = 0; f[n_] := Plus @@ Times @@@ FactorInteger[n]; g[n_] := -1 + Length @ NestWhileList[# + f[# - 1] + f[# + 1] &, n, PrimeQ]; seq[len_, max_] := Module[{s = Table[0, {len}], c = 0, p = 1, i}, While[p < max && c < len, p = NextPrime[p]; i = g[p]; If[i <= len && s[[i]] == 0, c++; s[[i]] = p]]; s]; seq[6, 10^7] (* Amiram Eldar, May 29 2022 *)
PROG
(Python)
from sympy import factorint, isprime, nextprime
def A001414(n): return sum(p*e for p, e in factorint(n).items())
def f(p): return p + A001414(p-1) + A001414(p+1)
def a(n):
p, count = 1, 0
while count != n:
p = nextprime(p)
fp, count = f(p), 1
while isprime(fp): fp = f(fp); count += 1
return p
print([a(n) for n in range(1, 6)]) # Michael S. Branicky, May 29 2022
CROSSREFS
Sequence in context: A037057 A065585 A139737 * A036113 A226840 A334885
KEYWORD
nonn,more
AUTHOR
J. M. Bergot and Robert Israel, May 24 2022
STATUS
approved