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.

Showing 1-2 of 2 results.

A332423 If n = Product (p_j^k_j) then a(n) = Sum ((-1)^(k_j + 1) * k_j).

Original entry on oeis.org

0, 1, 1, -2, 1, 2, 1, 3, -2, 2, 1, -1, 1, 2, 2, -4, 1, -1, 1, -1, 2, 2, 1, 4, -2, 2, 3, -1, 1, 3, 1, 5, 2, 2, 2, -4, 1, 2, 2, 4, 1, 3, 1, -1, -1, 2, 1, -3, -2, -1, 2, -1, 1, 4, 2, 4, 2, 2, 1, 0, 1, 2, -1, -6, 2, 3, 1, -1, 2, 3, 1, 1, 1, 2, -1, -1, 2, 3, 1, -3
Offset: 1

Views

Author

Ilya Gutkovskiy, Feb 12 2020

Keywords

Comments

Sum of odd exponents in prime factorization of n minus the sum of even exponents in prime factorization of n.

Examples

			a(2700) = a(2^2 * 3^3 * 5^2) = -2 + 3 - 2 = -1.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Plus @@ ((-1)^(#[[2]] + 1) #[[2]] & /@ FactorInteger[n]); a[1] = 0; Table[a[n], {n, 1, 80}]
  • PARI
    a(n) = vecsum(apply(x -> (-1)^(x+1) * x, factor(n)[, 2])); \\ Amiram Eldar, Oct 09 2023

Formula

From Amiram Eldar, Oct 09 2023: (Start)
Additive with a(p^e) = (-1)^(e+1) * e.
a(n) = A350387(n) - A350386(n).
Sum_{k=1..n} a(k) ~ n * (log(log(n)) + B - C), where B is Mertens's constant (A077761) and C = Sum_{p prime} (3*p+1)/(p*(p+1)^2) = 0.81918453457738985491 ... . (End)

A326440 a(n) = 1 - tau(1) + tau(2) - tau(3) + ... + (-1)^n tau(n), where tau = A000005 is number of divisors.

Original entry on oeis.org

1, 0, 2, 0, 3, 1, 5, 3, 7, 4, 8, 6, 12, 10, 14, 10, 15, 13, 19, 17, 23, 19, 23, 21, 29, 26, 30, 26, 32, 30, 38, 36, 42, 38, 42, 38, 47, 45, 49, 45, 53, 51, 59, 57, 63, 57, 61, 59, 69, 66, 72, 68, 74, 72, 80, 76, 84, 80, 84, 82, 94, 92, 96, 90, 97, 93, 101, 99
Offset: 0

Views

Author

Gus Wiseman, Jul 06 2019

Keywords

Comments

Is this sequence nonnegative?
As tau(n) is odd when n is a square, there are alternating strings of even and odd integers with change of parity for each n square. Indeed, between m^2 and (m+1)^2-1, there is a string of 2m+1 even terms if m is odd, or a string of 2m+1 odd terms if m is even. - Bernard Schott, Jul 10 2019

Examples

			The first 6 terms of A000005 are 1, 2, 2, 3, 2, 4, so a(6) = 1 - 1 + 2 - 2 + 3 - 2 + 4 = 5.
		

Crossrefs

Programs

  • Magma
    [1] cat [1+(&+[(-1)^(k)*#Divisors(k):k in [1..n]]):n in [1..70]]; // Marius A. Burtea, Jul 10 2019
  • Mathematica
    Accumulate[Table[If[k==0,1,(-1)^k*DivisorSigma[0,k]],{k,0,30}]]
  • PARI
    a(n) = 1 - sum(k=1, n, (-1)^(k+1)*numdiv(k)); \\ Michel Marcus, Jul 09 2019
    

Formula

a(n) = 1 + Sum_{k=1..n} (-1)^k A000005(k).
For n > 0, a(n) = 1 + A307704(n).
If p prime, a(p) = a(p-1) - 2. - Bernard Schott, Jul 10 2019
Showing 1-2 of 2 results.