OFFSET
1,2
COMMENTS
For all 1 <= k <= n, add 1 if k is prime, otherwise add n. For example, when n = 7, there are 4 numbers less than or equal to 7 that are prime and 3 that are not. Then a(7) = 1*4 + 7*3 = 25.
FORMULA
a(n) = Sum_{k=1..n} n^c(n), where c(n) is the characteristic function of nonprimes (A005171).
MATHEMATICA
Table[n + (n - 1)*(n - PrimePi[n]), {n, 50}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Jun 28 2021
STATUS
approved