cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A378844 Number of subsets of {1..n} whose arithmetic and harmonic means are both integers.

This page as a plain text file.
%I A378844 #23 Dec 14 2024 05:28:32
%S A378844 1,2,3,4,5,8,9,10,11,13,14,18,19,21,27,28,29,48,49,71,75,78,79,103,
%T A378844 104,105,106,203,204,325,326,327,530,533,795,1198,1199,1204
%N A378844 Number of subsets of {1..n} whose arithmetic and harmonic means are both integers.
%F A378844 a(p^k) = a(p^k-1)+1 for p prime (see A339453). - _Chai Wah Wu_, Dec 12 2024
%e A378844 a(6) = 8 subsets: {1}, {2}, {3}, {4}, {5}, {6}, {2, 6} and {1, 2, 3, 6}.
%t A378844 a[n_] := Count[Subsets[Range[n]], _?(# != {} && IntegerQ[Mean[#]] && IntegerQ[HarmonicMean[#]] &)]; Array[a, 20] (* _Amiram Eldar_, Dec 10 2024 *)
%o A378844 (PARI) a(n) = {my(c = 0); forsubset(n, s, if(#s && !(vecsum(Vec(s)) % #s) && denominator(#s/sum(i=1,#s,1/s[i])) == 1, c++)); c;} \\ _Amiram Eldar_, Dec 10 2024
%o A378844 (Python)
%o A378844 from math import lcm
%o A378844 from itertools import combinations
%o A378844 def A378844(n):
%o A378844     m = lcm(*range(2,n+1))
%o A378844     return sum(1 for l in range(1,n+1) for c in combinations(range(1,n+1),l) if not (sum(c)%l or l*m%sum(m//d for d in c))) # _Chai Wah Wu_, Dec 12 2024
%Y A378844 Cf. A051293, A326643, A339453.
%K A378844 nonn,more
%O A378844 1,2
%A A378844 _Ilya Gutkovskiy_, Dec 09 2024
%E A378844 a(25)-a(29) from _Amiram Eldar_, Dec 10 2024
%E A378844 a(30)-a(33) from _Chai Wah Wu_, Dec 12 2024
%E A378844 a(34)-a(38) from _Chai Wah Wu_, Dec 13 2024