login
A109278
Fastest increasing sequence in which a(n) is a prime closest to the sum of all previous terms.
2
2, 2, 5, 11, 19, 41, 79, 157, 317, 631, 1259, 2521, 5039, 10079, 20161, 40343, 80669, 161333, 322669, 645329, 1290673, 2581349, 5162681, 10325369, 20650753, 41301493, 82602997, 165205981, 330411959, 660823921, 1321647869, 2643295709, 5286591421, 10573182853
OFFSET
1,1
COMMENTS
A109277 is the slowest increasing sequence in which a(n) is a prime closest to the sum of all previous terms.
LINKS
FORMULA
Limit_{n->oo} a(n)/a(n-1) = 2. - Bruce Nye, Jan 14 2026
EXAMPLE
a(1)=2, sum(1)=2; prime closest to sum is 2, hence a(2)=2, sum(2)=4; there are two primes 3 and 5 closest to sum(2), we choose the largest one, hence a(3)=5, sum(3)=7, etc.
MAPLE
s:= proc(n) option remember; `if`(n<1, 0, s(n-1)+a(n)) end:
a:= proc(n) option remember; `if`(n=1, 2, (h-> ((p, q)->
`if`(q-h>h-p, p, q))(prevprime(h+1), nextprime(h-1)))(s(n-1)))
end:
seq(a(n), n=1..35); # Alois P. Heinz, Jan 14 2026
MATHEMATICA
s={2}; su=2; Do[If[PrimeQ[su], a=su, pp=PrimePi[su]; prv=Prime[pp]; nxt=Prime[pp+1]; a=If[su-prv<nxt-su, prv, nxt]]; AppendTo[s, a]; Print[a]; su+=a, {i, 42}]; s
PROG
(PARI)
my(N=40, v=vector(N), s=2); v[1]=s; for(n=2, N, my(lo=precprime(s), hi=nextprime(s)); v[n]=if(s-lo<hi-s, lo, hi); s+=v[n]); v \\ Bruce Nye, Jan 14 2026
CROSSREFS
Cf. A109277.
Sequence in context: A375317 A336269 A078405 * A367966 A112527 A216642
KEYWORD
nonn
AUTHOR
Zak Seidov, Jun 25 2005
EXTENSIONS
Definition and comment clarified by Jonathan Sondow, Jun 16 2012
STATUS
approved