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.

A349214 a(n) = Sum_{k=1..n} k^c(k), where c is the prime characteristic (A010051).

Original entry on oeis.org

1, 3, 6, 7, 12, 13, 20, 21, 22, 23, 34, 35, 48, 49, 50, 51, 68, 69, 88, 89, 90, 91, 114, 115, 116, 117, 118, 119, 148, 149, 180, 181, 182, 183, 184, 185, 222, 223, 224, 225, 266, 267, 310, 311, 312, 313, 360, 361, 362, 363, 364, 365, 418, 419, 420, 421, 422, 423, 482, 483, 544
Offset: 1

Views

Author

Wesley Ivan Hurt, Nov 10 2021

Keywords

Comments

For k in 1 <= k <= n, add k if k is prime, otherwise add 1. For example a(6) = 1 + 2 + 3 + 1 + 5 + 1 = 13.

Crossrefs

Partial sums of A089026.

Programs

  • Mathematica
    a[n_] := Sum[k^Boole[PrimeQ[k]], {k, 1, n}]; Array[a, 60] (* Amiram Eldar, Nov 11 2021 *)
  • PARI
    a(n) = sum(k=1, n, if (isprime(k), k, 1)); \\ Michel Marcus, Nov 11 2021
    
  • Python
    from sympy import primerange
    def A349214(n):
        p = list(primerange(2,n+1))
        return n-len(p)+sum(p) # Chai Wah Wu, Nov 11 2021

Formula

a(n) = A034387(n) + A062298(n). - Wesley Ivan Hurt, Nov 23 2021