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.

A316524 Signed sum over the prime indices of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Jul 05 2018

Keywords

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

Crossrefs

Cf. A027746, A112798, A119899 (positions of negative terms).
Cf. A344616 (absolute values), A344617 (signs).

Programs

  • Mathematica
    Table[Sum[Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]][[k]]*(-1)^(k-1),{k,PrimeOmega[n]}],{n,100}]
  • 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

Formula

a(n) = A344616(n) * A344617(n) = a(A007913(n)). - Antti Karttunen, May 06 2022

Extensions

More terms from Antti Karttunen, May 06 2022