OFFSET
1,2
COMMENTS
Also the number of subsets of {1,2,...,n} with sum of entries divisible by the largest element (compare A000016). See the Palmer Melbane link for a bijection. - Joel B. Lewis, Nov 13 2014
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..3333
Palmer Melbane, Art of Problem Solving thread. - Joel B. Lewis, Nov 13 2014
FORMULA
a(n) = (1/2)*Sum_{i=1..n} (f(i) - 1) where f(i) = (1/i) * Sum_{d | i and d is odd} 2^(i/d) * phi(d).
a(n) = (n + A051293(n))/2.
a(n) = 2^n - A327471(n). - Gus Wiseman, Sep 14 2019
EXAMPLE
a(4)=6, since {1}, {2}, {3}, {4}, {1,2,3} and {2,3,4} contain their averages.
From Gus Wiseman, Sep 14 2019: (Start)
The a(1) = 1 through a(6) = 16 subsets:
{1} {1} {1} {1} {1} {1}
{2} {2} {2} {2} {2}
{3} {3} {3} {3}
{1,2,3} {4} {4} {4}
{1,2,3} {5} {5}
{2,3,4} {1,2,3} {6}
{1,3,5} {1,2,3}
{2,3,4} {1,3,5}
{3,4,5} {2,3,4}
{1,2,3,4,5} {2,4,6}
{3,4,5}
{4,5,6}
{1,2,3,6}
{1,4,5,6}
{1,2,3,4,5}
{2,3,4,5,6}
(End)
MATHEMATICA
Table[ Sum[a = Select[Divisors[i], OddQ[ # ] &]; Apply[ Plus, 2^(i/a) * EulerPhi[a]]/i, {i, n}]/2, {n, 34}]
(* second program *)
Table[Length[Select[Subsets[Range[n]], MemberQ[#, Mean[#]]&]], {n, 0, 10}] (* Gus Wiseman, Sep 14 2019 *)
PROG
(PARI) a(n) = (1/2)*sum(i=1, n, (1/i)*sumdiv(i, d, if (d%2, 2^(i/d)*eulerphi(d)))); \\ Michel Marcus, Dec 20 2020
(Python)
from sympy import totient, divisors
def A065795(n): return sum((sum(totient(d)<<k//d-1 for d in divisors(k>>(~k&k-1).bit_length(), generator=True))<<1)//k for k in range(1, n+1))>>1 # Chai Wah Wu, Feb 22 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Dec 05 2001
EXTENSIONS
Edited and extended by Robert G. Wilson v, Nov 15 2002
STATUS
approved