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.
%I A309160 #18 Sep 25 2022 10:50:06 %S A309160 0,1,4,6,11,15,22,40,72,118,199,355,604,920,1306,1906,3281,6985,16446, %T A309160 38034,82490,168076,325935,604213,1068941,1815745,3038319,5246725, %U A309160 9796132,19966752,42918987,92984247,197027405,402932711,792381923,1499918753,2746078246 %N A309160 Number of nonempty subsets of [n] whose elements have a prime average. %H A309160 Alois P. Heinz, <a href="/A309160/b309160.txt">Table of n, a(n) for n = 1..200</a> %F A309160 a(n) < A051293(n). %e A309160 a(3) = 4 because 4 of the subsets of [3], namely {2}, {3}, {1,3}, {1,2,3}, have prime averages. %p A309160 b:= proc(n, s, c) option remember; `if`(n=0, %p A309160 `if`(c>0 and denom(s)=1 and isprime(s), 1, 0), %p A309160 b(n-1, s, c)+b(n-1, (s*c+n)/(c+1), c+1)) %p A309160 end: %p A309160 a:= n-> b(n, 0$2): %p A309160 seq(a(n), n=1..40); # _Alois P. Heinz_, Jul 15 2019 %t A309160 a[n_]:=Length[Select[Subsets[Range[n]],PrimeQ[Mean[#]]&]]; a/@Range[25] %o A309160 (Python) %o A309160 from sympy import isprime %o A309160 from functools import lru_cache %o A309160 def cond(s, c): q, r = divmod(s, c); return r == 0 and isprime(q) %o A309160 @lru_cache(maxsize=None) %o A309160 def b(n, s, c): %o A309160 if n == 0: return int (c > 0 and cond(s, c)) %o A309160 return b(n-1, s, c) + b(n-1, s+n, c+1) %o A309160 a = lambda n: b(n, 0, 0) %o A309160 print([a(n) for n in range(1, 41)]) # _Michael S. Branicky_, Sep 25 2022 %Y A309160 Cf. A051293, A114976, A127542. %K A309160 nonn %O A309160 1,3 %A A309160 _Ivan N. Ianakiev_, Jul 15 2019 %E A309160 a(26)-a(37) from _Alois P. Heinz_, Jul 15 2019