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.

A357355 Number of nonempty subsets of {1..n} whose elements have an odd average.

This page as a plain text file.
%I A357355 #12 Sep 25 2022 11:03:55
%S A357355 1,1,2,4,9,13,20,38,71,119,206,384,713,1285,2356,4428,8331,15569,
%T A357355 29270,55582,105717,200847,382808,732744,1404667,2694391,5178186,
%U A357355 9973416,19233457,37125547,71754692,138871244,269038123,521666967,1012485750,1966957674,3824314685
%N A357355 Number of nonempty subsets of {1..n} whose elements have an odd average.
%F A357355 a(n) = A051293(n) - A357356(n). - _Michael S. Branicky_, Sep 25 2022
%e A357355 a(6) = 13 subsets: {1}, {3}, {5}, {1, 5}, {2, 4}, {4, 6}, {1, 2, 6}, {1, 3, 5}, {2, 3, 4}, {4, 5, 6}, {1, 2, 3, 6}, {1, 2, 4, 5} and {1, 2, 3, 4, 5}.
%o A357355 (Python)
%o A357355 from functools import lru_cache
%o A357355 def cond(s, c): q, r = divmod(s, c); return r == 0 and q&1
%o A357355 @lru_cache(maxsize=None)
%o A357355 def b(n, s, c):
%o A357355     if n == 0: return int (c > 0 and cond(s, c))
%o A357355     return b(n-1, s, c) + b(n-1, s+n, c+1)
%o A357355 a = lambda n: b(n, 0, 0)
%o A357355 print([a(n) for n in range(1, 51)]) # _Michael S. Branicky_, Sep 25 2022
%Y A357355 Cf. A051293, A309160, A357356.
%K A357355 nonn
%O A357355 1,3
%A A357355 _Ilya Gutkovskiy_, Sep 25 2022
%E A357355 a(24)-a(37) from _Michael S. Branicky_, Sep 25 2022