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-7 of 7 results.

A344372 a(n) = Sum_{k = 1..n} gcd(2*k, n).

Original entry on oeis.org

1, 4, 5, 12, 9, 20, 13, 32, 21, 36, 21, 60, 25, 52, 45, 80, 33, 84, 37, 108, 65, 84, 45, 160, 65, 100, 81, 156, 57, 180, 61, 192, 105, 132, 117, 252, 73, 148, 125, 288, 81, 260, 85, 252, 189, 180, 93, 400, 133, 260, 165, 300, 105, 324, 189, 416, 185, 228, 117, 540, 121, 244, 273
Offset: 1

Views

Author

Max Alekseyev, May 16 2021

Keywords

Comments

For all n, a(n) >= 2*n - 1, where the equality holds if n is 1 or an odd prime.
a(n) equals the number of solutions to the congruence 2*x*y == 0 (mod n) for 1 <= x, y <= n. - Peter Bala, Jan 11 2024

Examples

			a(6) = 20: the 20 solutions to the congruence 2*x*y == 0 (mod 6) for 1 <= x, y <= 6 are the pairs (x, y) = (k, 6) for 1 <= k <= 6, the pairs (6, k) for 1 <= k <= 5, the pairs (3, k) for 1 <= k <= 5 and the pairs (1, 3), (2, 3), (4, 3) and (5, 3). - _Peter Bala_, Jan 11 2024
		

Crossrefs

Negated bisection of A199084.

Programs

  • Maple
    seq(add((-1)^k*gcd(k, 2*n), k = 1..2*n), n = 1..70);
    # alternative faster program for large n
    with(numtheory): seq(add(gcd(2,d)*phi(d)*n/d, d in divisors(n)), n = 1..70); # Peter Bala, Jan 08 2024
  • Mathematica
    f[p_, e_] := (e + 1)*p^e - e*p^(e - 1); f[2, e_] := (e + 1)*2^e; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Nov 20 2022 *)
    Table[Sum[GCD[2*k, n], {k, 1, n}], {n, 1, 60}] (* or *)
    Table[Sum[(-1)^k * GCD[k, 2*n], {k, 1, 2*n}], {n, 1, 60}] (* Vaclav Kotesovec, Jan 13 2024 *)
  • PARI
    { A344372(n) = my(f=factor(n)); prod(i=1,#f~, (f[i,2]+1)*f[i,1]^f[i,2] - if(f[i,1]>2,f[i,2]*f[i, 1]^(f[i,2]-1)) ); }
    
  • PARI
    a(n) = sum(k=1, 2*n, (-1)^k*gcd(k,2*n)); \\ Michel Marcus, May 17 2021

Formula

a(n) = Sum_{k = 1..2*n} (-1)^k * gcd(k,2*n).
a(n) is multiplicative with a(2^d) = (d+1)*2^d, and a(p^d) = (d+1)*p^d - d*p^(d-1) for an odd prime p, d >= 1.
a(n) = A344371(2*n) = -A199084(2*n) = 2*n - A106475(n-1).
a(n) = A018804(n) if n is odd, 4*A018804(n/2) if n is even. - Sebastian Karlsson, Aug 31 2021
From Peter Bala, Jan 11 2023: (Start)
a(n) = Sum_{d divides n} phi(2*d)*n/d, where phi(n) = A000010(n).
a(n) = - A332794(2*n); a(2*n+1) = A368736(2*n+1).
Dirichlet g.f.: 1/(1 - 1/2^s) * zeta(s-1)^2/zeta(s).
Define D(n) = Sum_{d divides n} a(d). Then
D(2*n+1) = (2*n + 1)*tau(2*n+1), where tau(n) = A000005(n), the number of divisors of n.
The sequence {(1/4)*( D(2*n) - D(n) ) : n >= 1} begins {1, 3, 6, 8, 10, 18, 14, 20, 27, 30, 22, 48, 26, 42, 60, 48, 34, 81, 38, 80, 84, 66, ...} and appears to be multiplicative. (End)
Sum_{k=1..n} a(k) ~ 4*n^2 * (log(n) - 1/2 + 2*gamma - log(2)/3 - 6*zeta'(2)/Pi^2) / Pi^2, where gamma is the Euler-Mascheroni constant A001620. - Vaclav Kotesovec, Jan 12 2024

Extensions

New name according to the formula by Peter Bala from Vaclav Kotesovec, Jan 13 2024

A344371 a(n) = Sum_{k=1..n} (-1)^(n-k) gcd(k,n).

Original entry on oeis.org

1, 1, 3, 4, 5, 5, 7, 12, 9, 9, 11, 20, 13, 13, 15, 32, 17, 21, 19, 36, 21, 21, 23, 60, 25, 25, 27, 52, 29, 45, 31, 80, 33, 33, 35, 84, 37, 37, 39, 108, 41, 65, 43, 84, 45, 45, 47, 160, 49, 65, 51, 100, 53, 81, 55, 156, 57, 57, 59, 180, 61, 61, 63, 192, 65, 105
Offset: 1

Views

Author

Max Alekseyev, May 16 2021

Keywords

Crossrefs

Programs

  • PARI
    a(n) = sum(k=1, n, (-1)^(n-k)*gcd(k,n)); \\ Michel Marcus, May 16 2021

Formula

a(n) = abs(A199084(n)).
a(2n+1) = 2n+1.
a(2n) = A344372(n) = 2*n - A106475(n-1).
Sum_{k=1..n} a(k) ~ (n^2/Pi^2) * (log(n) + 2*gamma - 1/2 - 4*log(2)/3 + Pi^2/4 - zeta'(2)/zeta(2)), where gamma is Euler's constant (A001620). - Amiram Eldar, Mar 30 2024

Extensions

More terms from Felix Fröhlich, May 19 2021

A106475 An alternating sum of greatest common divisors.

Original entry on oeis.org

1, 0, 1, -4, 1, -8, 1, -16, -3, -16, 1, -36, 1, -24, -15, -48, 1, -48, 1, -68, -23, -40, 1, -112, -15, -48, -27, -100, 1, -120, 1, -128, -39, -64, -47, -180, 1, -72, -47, -208, 1, -176, 1, -164, -99, -88, 1, -304, -35, -160, -63, -196, 1, -216, -79, -304, -71, -112, 1, -420, 1, -120, -147, -320, -95, -288, 1, -260, -87
Offset: 0

Views

Author

Paul Barry, May 03 2005

Keywords

Comments

With interpolated 0's, this is Sum_{k=0..n} gcd(n-k+1,k+1)*(-1)^k.

Crossrefs

Negated bisection of A344373.

Programs

Formula

a(n) = Sum_{k=0..2*n} gcd(2*n-k+1, k+1)*(-1)^k.
a(n) = 2(n+1) - A344371(2(n+1)) = 2(n+1) - A344372(n+1) = 2(n+1) + A199084(2(n+1)). - Max Alekseyev, May 16 2021
Sum_{k=1..n} a(k) ~ n^2 * (1 - (4/Pi^2)*(log(n) + 2*gamma - 1/2 - log(2)/3 - zeta'(2)/zeta(2))), where gamma is Euler's constant (A001620). - Amiram Eldar, Mar 30 2024

Extensions

More terms from Antti Karttunen, Mar 30 2021

A344373 a(n) = Sum_{k=1..n-1} (-1)^k gcd(k, n).

Original entry on oeis.org

0, -1, 0, 0, 0, -1, 0, 4, 0, -1, 0, 8, 0, -1, 0, 16, 0, 3, 0, 16, 0, -1, 0, 36, 0, -1, 0, 24, 0, 15, 0, 48, 0, -1, 0, 48, 0, -1, 0, 68, 0, 23, 0, 40, 0, -1, 0, 112, 0, 15, 0, 48, 0, 27, 0, 100, 0, -1, 0, 120, 0, -1, 0, 128, 0, 39, 0, 64, 0, 47, 0, 180, 0, -1, 0, 72, 0, 47, 0, 208, 0, -1, 0, 176, 0, -1, 0, 164, 0, 99
Offset: 1

Views

Author

Max Alekseyev, May 16 2021

Keywords

Comments

The usual OEIS policy is not to include sequences like this where alternate terms are zero; this is an exception.
For all n, a(n) >= -1. Equality holds for n = 2 and n = 2*p for an odd prime p.

Crossrefs

Programs

Formula

a(n) = -A199084(n) - (-1)^n*n = (-1)^n * (A344371(n) - n).
a(2*n+1) = 0.
a(2*n) = A344372(n) - 2*n = -A106475(n-1).
Sum_{k=1..n} a(k) ~ (n^2/4) * ((4/Pi^2)*(log(n) + 2*gamma - 1/2 - 4*log(2)/3 - zeta'(2)/zeta(2)) - 1), where gamma is Euler's constant (A001620). - Amiram Eldar, Mar 30 2024

Extensions

More terms from Antti Karttunen, May 16 2021

A332794 a(n) = Sum_{d|n} (-1)^(d + 1) * d * phi(n/d).

Original entry on oeis.org

1, -1, 5, -4, 9, -5, 13, -12, 21, -9, 21, -20, 25, -13, 45, -32, 33, -21, 37, -36, 65, -21, 45, -60, 65, -25, 81, -52, 57, -45, 61, -80, 105, -33, 117, -84, 73, -37, 125, -108, 81, -65, 85, -84, 189, -45, 93, -160, 133, -65, 165, -100, 105, -81, 189
Offset: 1

Views

Author

Ilya Gutkovskiy, Feb 24 2020

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Sum[(-1)^(d + 1) d EulerPhi[n/d], {d, Divisors[n]}]; Table[a[n], {n, 1, 55}]
    nmax = 55; CoefficientList[Series[Sum[EulerPhi[k] x^k/(1 + x^k)^2, {k, 1, nmax}], {x, 0, nmax}], x] // Rest
    a[n_] := If[OddQ[n], Sum[GCD[n, k], {k, 1, n}], Sum[(-1)^(k + 1) GCD[n, k], {k, 1, n}]]; Table[a[n], {n, 1, 55}]
    f[p_, e_] := (e*(p-1) + p)*p^(e-1); f[2, e_] := -e*2^(e-1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Nov 04 2022 *)
  • PARI
    a(n) = sumdiv(n, d, (-1)^(d+1)*d*eulerphi(n/d)); \\ Michel Marcus, Feb 24 2020

Formula

G.f.: Sum_{k>=1} phi(k) * x^k / (1 + x^k)^2.
Dirichlet g.f.: zeta(s-1)^2 * (1 - 2^(2 - s)) / zeta(s).
a(n) = Sum_{k=1..n} gcd(n, k) if n odd, Sum_{k=1..n} (-1)^(k + 1) * gcd(n, k) if n even.
From Amiram Eldar, Nov 04 2022: (Start)
Multiplicative with a(2^e) = -e*2^(e-1), and a(p^e) = (e*(p-1) + p)*p^(e-1) for p > 2.
Sum_{k=1..n} a(k) ~ c * n^2, where c = 3*log(2)/Pi^2 = 0.210691... . (End)
a(2*n) = - Sum_{k = 1..n} gcd(2*k, n) = - A344372(n); a(2*n+1) = A018804(2*n+1). - Peter Bala, Jan 11 2024
a(n) = Sum_{k = 1..n} (-1)^(1 + gcd(k, n)) * gcd(k, n) (follows from an identity of Cesàro. See, for example, Bordelles, Lemma 1). - Peter Bala, Jan 16 2024

A199806 Alternating LCM-sum: a(n) = Sum_{k=1..n} (-1)^(k-1)*lcm(k,n).

Original entry on oeis.org

1, 0, 0, 8, -5, 18, -14, 80, -9, 100, -44, 204, -65, 294, 30, 672, -119, 540, -152, 1040, 63, 1210, -230, 1752, -75, 2028, -54, 2996, -377, 2190, -434, 5440, 165, 4624, 280, 5472, -629, 6498, 234, 8800, -779, 6300, -860, 12188, 225, 11638, -1034, 14256, -245, 13000
Offset: 1

Views

Author

Laszlo Toth, Nov 10 2011

Keywords

Crossrefs

Programs

A333493 a(n) = Sum_{k=1..n} (-1)^(k+1) * lcm(n,k) / gcd(n,k).

Original entry on oeis.org

1, 1, -2, 13, -9, 28, -20, 109, -11, 151, -54, 256, -77, 442, 48, 877, -135, 757, -170, 1363, 103, 1816, -252, 2080, -59, 3043, -38, 3982, -405, 2878, -464, 7021, 273, 6937, 390, 6817, -665, 9748, 388, 11059, -819, 8407, -902, 16348, 219, 17458, -1080, 16672, -167
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 24 2020

Keywords

Crossrefs

Alternating row sums of A051537.

Programs

  • Mathematica
    Table[Sum[(-1)^(k + 1) LCM[n, k]/GCD[n, k], {k, 1, n}], {n, 1, 49}]
  • PARI
    a(n) = sum(k=1, n, (-1)^(k+1)*lcm(n, k)/gcd(n, k)); \\ Michel Marcus, Mar 24 2020

Formula

If n odd, a(n) = (1/2) * n * Sum_{d|n} Sum_{j|d} (-1)^(j + 1) * mu(d/j) * (n + d) / j^2.
If n even, a(n) = (1/2) * n^2 * Sum_{d|n} Sum_{j|d} (-1)^(j + 1) * mu(d/j) * (n + d) / (d * j^2).
Showing 1-7 of 7 results.