A344879 a(n) = A344875(n) / A344878(n), where A344875(n) is multiplicative with a(2^e) = 2^(1+e) - 1, and a(p^e) = p^e -1 for odd primes p, and A344878(n) gives the least common multiple of the same factors.
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 3, 2, 1, 1, 6, 1, 1, 4, 1, 1, 1, 1, 3, 2, 1, 1, 1, 2, 3, 2, 1, 1, 2, 1, 3, 2, 1, 4, 2, 1, 1, 2, 6, 1, 1, 1, 3, 2, 1, 2, 6, 1, 1, 1, 1, 1, 2, 4, 3, 2, 5, 1, 4, 6, 1, 2, 1, 2, 1, 1, 3, 2, 1, 1, 2, 1, 3, 4
Offset: 1
Keywords
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
Programs
-
Mathematica
f[2, e_] := 2^(e + 1) - 1; f[p_, e_] := p^e - 1; a[1] = 1; a[n_] := Times @@ (fct = f @@@ FactorInteger[n])/LCM @@ fct; Array[a, 100] (* Amiram Eldar, Jun 03 2021 *)
-
PARI
A344875(n) = { my(f=factor(n)~); prod(i=1, #f, (f[1, i]^(f[2, i]+(2==f[1, i]))-1)); }; A344878(n) = if(1==n,n, my(f=factor(n)~); lcm(vector(#f, i, (f[1, i]^(f[2, i]+(2==f[1, i]))-1)))); A344879(n) = (A344875(n) / A344878(n));
-
Python
from math import prod, lcm from sympy import factorint def A344879(n): return prod(a := tuple(p**(e+int(p==2))-1 for p, e in factorint(n).items()))//lcm(*a) # Chai Wah Wu, Jun 15 2022