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.

A367870 a(n) = Sum_{d|n, d odd} (n-d).

Original entry on oeis.org

0, 1, 2, 3, 4, 8, 6, 7, 14, 14, 10, 20, 12, 20, 36, 15, 16, 41, 18, 34, 52, 32, 22, 44, 44, 38, 68, 48, 28, 96, 30, 31, 84, 50, 92, 95, 36, 56, 100, 74, 40, 136, 42, 76, 192, 68, 46, 92, 90, 119, 132, 90, 52, 176, 148, 104, 148, 86, 58, 216, 60, 92, 274, 63, 176, 216
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 03 2023

Keywords

Comments

Total distance from n to each odd divisor of n.

Examples

			a(15) = 36. The total distance from 15 to each of its odd divisors is (15-1) + (15-3) + (15-5) + (15-15) = 36.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local x,d;
      x:= n/2^padic:-ordp(n,2);
      add(n-d, d = numtheory:-divisors(x))
    end proc:
    map(f, [$1..100]); # Robert Israel, Dec 04 2023
  • Mathematica
    Table[DivisorSum[n, n-# &, OddQ], {n, 100}] (* Paolo Xausa, Mar 05 2024 *)
  • PARI
    a(n) = sumdiv(n, d, if (d%2, n-d)); \\ Michel Marcus, Dec 04 2023
    
  • Python
    from math import prod
    from sympy import factorint
    def A367870(n):
        f = factorint(n>>(~n&n-1).bit_length())
        return n*prod(e+1 for e in f.values())-prod((p**(e+1)-1)//(p-1) for p,e in f.items()) # Chai Wah Wu, Dec 31 2023

Formula

a(n) = A245579(n) - A000593(n).
a(n) = n*A001227(n) - A000593(n).