login
A349214
a(n) = Sum_{k=1..n} k^c(k), where c is the prime characteristic (A010051).
1
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,2
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.
LINKS
FORMULA
a(n) = A034387(n) + A062298(n). - Wesley Ivan Hurt, Nov 23 2021
MATHEMATICA
a[n_] := Sum[k^Boole[PrimeQ[k]], {k, 1, n}]; Array[a, 60] (* Amiram Eldar, Nov 11 2021 *)
PROG
(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
CROSSREFS
Partial sums of A089026.
Sequence in context: A032849 A038591 A333794 * A182181 A138038 A095029
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Nov 10 2021
STATUS
approved