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.

A348915 a(n) = Sum_{d|n} d^(d mod 2).

Original entry on oeis.org

1, 2, 4, 3, 6, 6, 8, 4, 13, 8, 12, 8, 14, 10, 24, 5, 18, 16, 20, 10, 32, 14, 24, 10, 31, 16, 40, 12, 30, 28, 32, 6, 48, 20, 48, 19, 38, 22, 56, 12, 42, 36, 44, 16, 78, 26, 48, 12, 57, 34, 72, 18, 54, 44, 72, 14, 80, 32, 60, 32, 62, 34, 104, 7, 84, 52, 68, 22, 96, 52, 72, 22, 74
Offset: 1

Views

Author

Wesley Ivan Hurt, Nov 03 2021

Keywords

Comments

For each divisor d of n, add d if d is odd, otherwise add 1.
Inverse Möbius transform of n^(n mod 2). - Wesley Ivan Hurt, Mar 31 2025

Examples

			For n = 12, the divisors of 12 are 1, 2, 3, 4, 6, 12 with corresponding summands 1, 1, 3, 1, 1, 1, respectively. The sum is then a(12) = 1 + 1 + 3 + 1 + 1 + 1 = 8.
		

Crossrefs

Cf. A000005 (tau), A000203 (sigma), A000593, A065608, A183063.

Programs

  • Maple
    f:= proc(n) local d;
      add(d^(d mod 2), d = numtheory:-divisors(n))
    end proc;
    map(f, [$1..100]); # Robert Israel, Jun 01 2025
  • Mathematica
    a[n_] := DivisorSum[n, #^Mod[#, 2] &]; Array[a, 100] (* Amiram Eldar, Nov 04 2021 *)
  • PARI
    a(n) = sumdiv(n, d, if (d%2, d, 1)); \\ Michel Marcus, Nov 04 2021
    
  • Python
    from math import prod
    from sympy import factorint
    def A348915(n):
        f = factorint(n>>(m:=(~n&n-1).bit_length())).items()
        d = prod(e+1 for p,e in f)
        s = prod((p**(e+1)-1)//(p-1) for p, e in f)
        return s+d*m # Chai Wah Wu, Jul 16 2022

Formula

a(n) = A000593(n) + A183063(n).
a(n) = A065608(2n) - 2*A065608(n).
a(p) = p+1 for odd primes p. - Wesley Ivan Hurt, Nov 28 2021
a(n) = A000203(A000265(n))+A000005(A000265(n))*A007814(n). - Chai Wah Wu, Jul 16 2022
a(n) = A000203(n) if n is odd. - Robert Israel, Jun 01 2025