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.

A357356 Number of nonempty subsets of {1..n} whose elements have an even average.

This page as a plain text file.
%I A357356 #10 Sep 25 2022 11:04:09
%S A357356 0,1,3,4,6,13,25,38,64,119,219,384,686,1285,2405,4428,8236,15569,
%T A357356 29463,55582,105326,200847,383609,732744,1403004,2694391,5181663,
%U A357356 9973416,19226166,37125547,71770069,138871244,269005540,521666967,1012555015,1966957674,3824166974
%N A357356 Number of nonempty subsets of {1..n} whose elements have an even average.
%F A357356 a(n) = A051293(n) - A357355(n). - _Michael S. Branicky_, Sep 25 2022
%e A357356 a(6) = 13 subsets: {2}, {4}, {6}, {1, 3}, {2, 6}, {3, 5}, {1, 2, 3}, {1, 5, 6}, {2, 4, 6}, {3, 4, 5}, {1, 4, 5, 6}, {2, 3, 5, 6} and {2, 3, 4, 5, 6}.
%o A357356 (Python)
%o A357356 from functools import lru_cache
%o A357356 def cond(s, c): q, r = divmod(s, c); return r == 0 and q&1 == 0
%o A357356 @lru_cache(maxsize=None)
%o A357356 def b(n, s, c):
%o A357356     if n == 0: return int (c > 0 and cond(s, c))
%o A357356     return b(n-1, s, c) + b(n-1, s+n, c+1)
%o A357356 a = lambda n: b(n, 0, 0)
%o A357356 print([a(n) for n in range(1, 51)]) # _Michael S. Branicky_, Sep 25 2022
%Y A357356 Cf. A051293, A309160, A357355.
%K A357356 nonn
%O A357356 1,3
%A A357356 _Ilya Gutkovskiy_, Sep 25 2022
%E A357356 a(24)-a(37) from _Michael S. Branicky_, Sep 25 2022