OFFSET
1,11
COMMENTS
Also number of divisors of n which end in 1 or 9 minus number of divisors of n which end in 3 or 7. E.g. a(98)=2-1=1 since divisors of 98 are: 1 and 49 counting +1 each; 2, 14 and 98 counting 0 each; and 7 counting -1. - Henry Bottomley, Jul 08 2003
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
MathNerds, An Excess of Divisors. [Wayback Machine link]
FORMULA
From Amiram Eldar, Nov 19 2023: (Start)
a(n) = Sum_{d|n} Kronecker(20, d).
Multiplicative with a(p^e) = 1 if Kronecker(20, p) = 0 (p = 2 or 5), a(p^e) = (1+(-1)^e)/2 if Kronecker(20, p) = -1 (p is in A003631 \ {2}), and a(p^e) = e+1 if Kronecker(20, p) = 1 (p is in A045468).
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3*log(phi)/sqrt(5) = 0.645613411446..., where phi is the golden ratio (A001622). (End)
MAPLE
a:= proc(n) local D, d; D:= map(`modp`, convert(numtheory:-divisors(n), list), 10);
numboccur(1, D) + numboccur(9, D) - numboccur(3, D) - numboccur(7, D);
end proc:
seq(a(n), n=1..1000); # Robert Israel, Sep 22 2014
MATHEMATICA
a[n_] := With[{d = Mod[Divisors[n], 10]}, Count[d, 1|9] - Count[d, 3|7]];
Table[a[n], {n, 1, 105}] (* Jean-François Alcover, May 15 2023 *)
a[n_] := DivisorSum[n, KroneckerSymbol[20, #] &]; Array[a, 100] (* Amiram Eldar, Nov 19 2023 *)
PROG
(PARI) my(m = 20); direuler(p=2, 101, 1/(1-(kronecker(m, p)*(X-X^2))-X))
(PARI) a(n) = sumdiv(n, d, kronecker(20, d)); \\ Amiram Eldar, Nov 19 2023
CROSSREFS
KEYWORD
nonn,easy,mult
AUTHOR
EXTENSIONS
More terms from Henry Bottomley, Jul 08 2003
STATUS
approved