a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + sum of prior prime terms.
+40
0
0
2, 3, 8, 13, 31, 80, 129, 178, 227, 503, 1282, 2061, 2840, 3619, 4398, 5177, 5956, 6735, 7514, 8293, 17365, 26437, 61946, 97455, 132964, 168473, 203982, 239491, 275000, 310509, 346018, 381527, 798563, 1215599, 1632635, 2049671, 2466707, 5350450, 8234193, 11117936
OFFSET
1,1
LINKS
James C. McMahon, Table of n, a(n) for n = 1..10000
EXAMPLE
For n=5, a(5) = a(4) + sum of prior primes = 13 + (2 + 3 + 13) = 31, so that 13 is counted twice.
MATHEMATICA
Nest[Append[#, #[[-1]]+Total[Select[#, PrimeQ]]]&, {2, 3}, 38]
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def agen(): # generator of terms
yield from [2, 3]
primesum, an = 5, 3
while True:
an += primesum
if isprime(an): primesum += an
yield an
print(list(islice(agen(), 40))) # Michael S. Branicky, Feb 19 2025
KEYWORD
nonn,new
AUTHOR
James C. McMahon, Feb 15 2025
STATUS
approved
This sequence is similar to my other sequence submitted at the same time, A381150. However, I think A381150 is more interesting because of the terms that repeat and also how it cycles between positive and negative terms. Link to prior post: https://jamesmacmath.blogspot.com/2025/02/a-sequence-with-competing-sums-of-prior.html
No comments:
Post a Comment