login
A316524
Signed sum over the prime indices of n.
141
0, 1, 2, 0, 3, -1, 4, 1, 0, -2, 5, 2, 6, -3, -1, 0, 7, 1, 8, 3, -2, -4, 9, -1, 0, -5, 2, 4, 10, 2, 11, 1, -3, -6, -1, 0, 12, -7, -4, -2, 13, 3, 14, 5, 3, -8, 15, 2, 0, 1, -5, 6, 16, -1, -2, -3, -6, -9, 17, -1, 18, -10, 4, 0, -3, 4, 19, 7, -7, 2, 20, 1, 21, -11, 2, 8, -1, 5, 22, 3, 0, -12, 23, -2, -4, -13, -8, -4, 24
OFFSET
1,3
COMMENTS
If n = prime(x_1) * prime(x_2) * prime(x_3) * ... * prime(x_k) then a(n) = x_1 - x_2 + x_3 - ... + (-1)^(k-1) x_k, where the x_i are weakly increasing positive integers.
The value of a(n) depends only on the squarefree part of n, A007913(n). - Antti Karttunen, May 06 2022
FORMULA
a(n) = A344616(n) * A344617(n) = a(A007913(n)). - Antti Karttunen, May 06 2022
MATHEMATICA
Table[Sum[Flatten[Cases[FactorInteger[n], {p_, k_}:>Table[PrimePi[p], {k}]]][[k]]*(-1)^(k-1), {k, PrimeOmega[n]}], {n, 100}]
PROG
(PARI) a(n) = {my(f = factor(n), vp = []); for (k=1, #f~, for( j=1, f[k, 2], vp = concat (vp, primepi(f[k, 1]))); ); sum(k=1, #vp, vp[k]*(-1)^(k+1)); } \\ Michel Marcus, Jul 06 2018
(Python)
from sympy import factorint, primepi
def A316524(n):
fs = [primepi(p) for p in factorint(n, multiple=True)]
return sum(fs[::2])-sum(fs[1::2]) # Chai Wah Wu, Aug 23 2021
CROSSREFS
Cf. A027746, A112798, A119899 (positions of negative terms).
Cf. A344616 (absolute values), A344617 (signs).
Sequence in context: A277707 A357634 A344616 * A357630 A194549 A063277
KEYWORD
sign
AUTHOR
Gus Wiseman, Jul 05 2018
EXTENSIONS
More terms from Antti Karttunen, May 06 2022
STATUS
approved