cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A381149 a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + sum of prior prime terms.

Original entry on oeis.org

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

Views

Author

James C. McMahon, Feb 15 2025

Keywords

Examples

			For n=5, a(5) = a(4) + sum of prior primes = 13 + (2 + 3 + 13) = 31, so that 13 is counted twice.
		

Crossrefs

Programs

  • Mathematica
    Nest[Append[#,#[[-1]]+Total[Select[#,PrimeQ]]]&,{2,3},38]
  • 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

A381150 a(0) = 1, a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + (sum of prior prime terms or whose negatives are prime) - (sum of prior composite terms or whose negatives are composite).

Original entry on oeis.org

1, 2, 3, 8, 5, 7, 16, 9, -7, -30, -23, -39, -16, 23, 85, 62, -23, -131, -370, -239, -347, -802, -455, 347, 1496, 1149, -347, -2190, -1843, 347, 2884, 2537, -347, -3578, -3231, 347, 4272, 3925, -347, -4966, -4619, 347, 5660, 5313, -347, -6354, -6007, -11667, -5660
Offset: 0

Views

Author

James C. McMahon, Feb 15 2025

Keywords

Examples

			For n=5, a(5) = 5 + (2 + 3 + 5) - 8 = 7.
For n=9, a(9) = -7 + (2 + 3 + 5 + 7 -7) - (8 + 16 + 9) = -7 + 10 - 33 = -30
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<1, 0, b(n-1)+(t->
         `if`(isprime(abs(t)), t, `if`(abs(t)>1, -t, 0)))(a(n)))
        end:
    a:= proc(n) option remember; `if`(n<3, n+1, a(n-1)+b(n-1)) end:
    seq(a(n), n=0..48);  # Alois P. Heinz, Feb 15 2025
  • Mathematica
    Nest[Append[#,#[[-1]]+Total[Select[#,PrimeQ]]-Total[Select[#,CompositeQ]]]&,{1,2,3},46]
Showing 1-2 of 2 results.