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

A071324 Alternating sum of all divisors of n; divisors nonincreasing, starting with n.

Original entry on oeis.org

1, 1, 2, 3, 4, 4, 6, 5, 7, 6, 10, 8, 12, 8, 12, 11, 16, 13, 18, 12, 16, 12, 22, 16, 21, 14, 20, 18, 28, 22, 30, 21, 24, 18, 32, 25, 36, 20, 28, 24, 40, 32, 42, 30, 36, 24, 46, 32, 43, 31, 36, 36, 52, 40, 48, 38, 40, 30, 58, 40, 60, 32, 46, 43, 56, 48, 66, 48, 48, 42, 70, 49, 72
Offset: 1

Views

Author

Reinhard Zumkeller, May 18 2002, Jul 03 2008

Keywords

Comments

Alternating row sums of A056538. - Omar E. Pol, Feb 17 2024
Does a constant analogous to the median abundancy index (see A353617) exist for this function? Particularly, does a constant exist such that the numbers having the value a(n)/n greater than this constant have natural density exactly 1/2? Using the first 10^7 values, one observes that if it exists, this constant appears to converge around 0.726. - Shreyansh Jaiswal, Apr 16 2025

Examples

			Divisors of 20: {1,2,4,5,10,20} therefore a(20) = 20 - 10 + 5 - 4 + 2 - 1 = 12.
		

Crossrefs

Cf. A000010, A000203, A071322, a(n) = abs(A071323(n)).
Cf. A056538.

Programs

  • Maple
    with(numtheory): a:=proc(n) local k, t:=0, A:=divisors(n); for k to tau(n) do t:= t+A[k]*(-1)^(tau(n)-k) end do; return t; end proc; seq(a(n), n=1..60); # Ridouane Oudra, Nov 23 2022
  • Mathematica
    a[n_] := Plus @@ (-(d = Divisors[n])*(-1)^(Range[Length[d],1,-1])); Array[a, 100] (* Amiram Eldar, Mar 11 2020 *)
    Table[Total[Times@@@Partition[Riffle[Reverse[Divisors[n]],{1,-1},{2,-1,2}],2]],{n,80}] (* Harvey P. Dale, Nov 06 2022 *)
  • PARI
    a(n) = my(d=Vecrev(divisors(n))); sum(k=1, #d, (-1)^(k+1)*d[k]); \\ Michel Marcus, Aug 11 2018
    (APL, Dyalog dialect)
    divisors ← {⍺←⍵{(0=⍵|⍺)/⍵}⍳⌊⍵*÷2 ⋄ 1=⍵:⍺ ⋄ ⍺,(⍵∘÷)¨(⍵=(⌊⍵*÷2)*2)↓⌽⍺}
    A071324 ← {-/⌽(divisors ⍵)} ⍝ Antti Karttunen, Feb 16 2024
    
  • Python
    from sympy import divisors;  from functools import lru_cache
    cached_divisors = lru_cache()(divisors)
    def a(n):  return sum(d if i%2==0 else -d for i, d in enumerate(reversed(cached_divisors(n))))
    A071324 = [a(i) for i in range(1, 74)]  # Jwalin Bhatt, Apr 02 2025

Formula

a(A028983(n)) mod 2 = 0; a(A028982(n)) mod 2 = 1.
a(n) = Sum_{i=1..n} (A135539(n,i) mod 2). - Ridouane Oudra, Nov 23 2022
From Shreyansh Jaiswal, Apr 16 2025: (Start)
a(p) = p-1 for prime p.
For odd n, 2n/3 <= a(n) <= n.
For even n, n/2 <= a(n) <= 5n/6.
a(n) >= A000010(n) for n>=1. (End)

A353615 a(n) is the numerator of the median abundancy index of the first 2^n + 1 positive integers.

Original entry on oeis.org

4, 4, 13, 3, 32, 45, 63, 90, 111, 162, 210, 237, 7502, 11776, 240, 2944, 3008, 11648, 225152, 478080, 2704000, 1548160, 2462400, 10128256, 4999296, 8640768, 48264064, 32347648
Offset: 1

Views

Author

Amiram Eldar, Apr 30 2022

Keywords

Comments

The abundancy index of a number k is sigma(k)/k = A017665(k)/A017666(k), where sigma is the sum-of-divisors function (A000203).

Examples

			The fractions begin with 4/3, 4/3, 13/9, 3/2, 32/21, 45/29, 63/41, 90/59, 111/73, 162/107, ...
The abundancy indices of the first 3 positive integers are 1, 3/2 and 4/3. The median is a(1)/A353616(1) = 4/3.
		

Crossrefs

Cf. A000203, A017665, A017666, A353616 (denominators), A353617.

Programs

  • Mathematica
    With[{m = 20}, t = Table[DivisorSigma[-1, n], {n, 1, 2^m + 1}]; Numerator @ Table[Median[t[[1 ;; 2^n + 1]]], {n, 1, m}]]

Formula

Limit_{n->oo} a(n)/A353616(n) = A353617.

A353616 a(n) is the denominator of the median abundancy index of the first 2^n + 1 positive integers.

Original entry on oeis.org

3, 3, 9, 2, 21, 29, 41, 59, 73, 107, 139, 157, 4941, 7707, 157, 1929, 1973, 7643, 147749, 313733, 1774479, 1015973, 1615943, 6646647, 3280781, 5670497, 31673271, 21228137
Offset: 1

Views

Author

Amiram Eldar, Apr 30 2022

Keywords

Comments

See A353615 for more details.

Crossrefs

Cf. A000203, A017665, A017666, A353615 (numerators), A353617.

Programs

  • Mathematica
    With[{m = 20}, t = Table[DivisorSigma[-1, n], {n, 1, 2^m + 1}]; Denominator @ Table[Median[t[[1 ;; 2^n + 1]]], {n, 1, m}]]
Showing 1-3 of 3 results.