A065795 Number of subsets of {1,2,...,n} that contain the average of their elements.
1, 2, 4, 6, 10, 16, 26, 42, 72, 124, 218, 390, 706, 1292, 2388, 4436, 8292, 15578, 29376, 55592, 105532, 200858, 383220, 732756, 1403848, 2694404, 5179938, 9973430, 19229826, 37125562, 71762396, 138871260, 269021848, 521666984, 1012520400, 1966957692, 3824240848
Offset: 1
Keywords
Examples
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)
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..3333
- Palmer Melbane, Combinations under constraint, Art of Problem Solving thread. - _Joel B. Lewis_, Nov 13 2014
Crossrefs
Programs
-
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 *)
-
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&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))>>1 # Chai Wah Wu, Feb 22 2023
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
Extensions
Edited and extended by Robert G. Wilson v, Nov 15 2002
Comments