login
Number of subsets of {1..n} containing n whose mean is not an element.
5

%I #16 Feb 22 2023 01:44:49

%S 0,0,1,2,6,12,26,54,112,226,460,930,1876,3780,7606,15288,30720,61680,

%T 123786,248346,498072,998636,2001826,4011942,8039072,16106124,

%U 32263876,64623330,129424236,259179060,518975176,1039104990,2080374784,4164816708,8337289456

%N Number of subsets of {1..n} containing n whose mean is not an element.

%F From _Alois P. Heinz_, Feb 21 2023: (Start)

%F a(n) = A327471(n) - A327471(n-1) for n>=1.

%F a(n) = 2^(n-1) - A000016(n) for n>=1. (End)

%e The a(1) = 1 through a(5) = 12 subsets:

%e {1,2} {1,3} {1,4} {1,5}

%e {2,3} {2,4} {2,5}

%e {3,4} {3,5}

%e {1,2,4} {4,5}

%e {1,3,4} {1,2,5}

%e {1,2,3,4} {1,4,5}

%e {2,3,5}

%e {2,4,5}

%e {1,2,3,5}

%e {1,2,4,5}

%e {1,3,4,5}

%e {2,3,4,5}

%t Table[Length[Select[Subsets[Range[n]],MemberQ[#,n]&&!MemberQ[#,Mean[#]]&]],{n,0,10}]

%o (Python)

%o from sympy import totient, divisors

%o def A327477(n): return (1<<n-1)-sum(totient(d)<<n//d-1 for d in divisors(n>>(~n&n-1).bit_length(),generator=True))//n if n else 0 # _Chai Wah Wu_, Feb 21 2023

%Y Subsets whose mean is an element are A065795.

%Y Subsets whose mean is not an element are A327471.

%Y Subsets containing n whose mean is an element are A000016.

%Y Cf. A007865, A051293, A082550, A135342, A240851, A324741, A327472.

%K nonn

%O 0,4

%A _Gus Wiseman_, Sep 13 2019

%E a(25)-a(34) from _Alois P. Heinz_, Feb 21 2023