OFFSET
1,12
COMMENTS
If n is even and a(n) > 0, then n can be written as the sum of 4 divisors of n (not necessarily distinct). For example, 6 = 1+2+1+2 and 12 = 3+3+3+3 but 14 cannot be written as the sum of 4 of its divisors since 14 is even, but a(14) = 0. [See discussion in A354591].
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (-2,-3,-3,-2,0,2,3,3,2,1).
FORMULA
a(n) = Sum_{d|n, d = 3, 4, or 5} 1.
a(n) = Sum_{d|n} ([d = 3] + [d = 4] + [d = 5]), where [ ] is the Iverson bracket.
a(n) = Sum_{d|n} Sum_{k=3..5} [d = k], where [ ] is the Iverson bracket.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 47/60. - Amiram Eldar, Nov 12 2023
From Andrew Howroyd, Nov 14 2025: (Start)
a(n) = a(n-60).
G.f.: x^3*(1 + 3*x + 6*x^2 + 9*x^3 + 10*x^4 + 9*x^5 + 6*x^6 + 3*x^7)/((1 - x)*(1 + x)*(1 + x^2)*(1 + x + x^2)*(1 + x + x^2 + x^3 + x^4)). (End)
a(n) = - 2*a(n-1) - 3*a(n-2) - 3*a(n-3) - 2*a(n-4) + 2*a(n-6) + 3*a(n-7) + 3*a(n-8) + 2*a(n-9) + a(n-10). - Wesley Ivan Hurt, Nov 28 2025
EXAMPLE
a(12) = 2 since exactly two of its divisors are members of the set {3,4,5}.
MATHEMATICA
Table[Sum[Sum[KroneckerDelta[k, j], {j, 3, 5}] (1 - Ceiling[n/k] + Floor[n/k]), {k, n}], {n, 100}]
a[n_] := Total[Sign[IntegerExponent[n, {3, 4, 5}]]]; Array[a, 100] (* Amiram Eldar, Nov 12 2023 *)
PROG
(PARI) a(n) = sumdiv(n, d, (d>=3) && (d<=5)); \\ Michel Marcus, Nov 11 2023
(PARI) a(n) = (valuation(n, 3)>0) + (valuation(n, 2)>1) + (valuation(n, 5)>0); \\ Amiram Eldar, Nov 12 2023
(Python)
def A366981(n): return sum(int(not n%d) for d in range(3, 6)) # Chai Wah Wu, Nov 12 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Oct 30 2023
STATUS
approved
