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.

A383968 Number of distinct subsets S of [1..n] such that for all 1 <= k <= n, there exists two elements x,y in S (not necessarily distinct) such that x+y = 2k.

This page as a plain text file.
%I A383968 #23 May 29 2025 00:12:01
%S A383968 1,1,2,3,5,9,17,30,58,107,205,392,768,1466,2883,5597,11038,21572,
%T A383968 42675,83711,166371,327893,651199,1288480,2564032,5082878,10127472,
%U A383968 20115845,40104636,79781149,159174500,316962113,632716744,1261189166,2518287361,5023170116,10034132101,20025033970
%N A383968 Number of distinct subsets S of [1..n] such that for all 1 <= k <= n, there exists two elements x,y in S (not necessarily distinct) such that x+y = 2k.
%C A383968 Every subset S of [1..n] must have 1 and n to get 2 and 2*n. For odd n we therefore have 1+n which we need as well. If S is no such subset then no subset S' of S must be tested. - _David A. Corneth_, May 22 2025
%H A383968 David A. Corneth, <a href="/A383968/a383968.gp.txt">PARI program</a>
%H A383968 Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a383/A383968.java">Java program</a> (github)
%e A383968 For n = 5, there are 5 sets S that satisfy the said conditions: {1, 2, 3, 4, 5}, {1, 2, 3, 5}, {1, 2, 4, 5}, {1, 3, 4, 5} and {1, 3, 5}.
%o A383968 (Python)
%o A383968 def a(n):
%o A383968     if n == 1: return 1
%o A383968     c,t = 0, set(k << 1 for k in range(1, n+1))
%o A383968     for i in range(1 << (n-2), 1 << n):
%o A383968         s = [j+1 for j in range(n) if (i >> j) & 1]
%o A383968         if s[0] == 1 and s[-1] == n:
%o A383968             ss = set(x + y for x in s for y in s if x & 1 == y & 1)
%o A383968             if t.issubset(ss): c += 1
%o A383968     return c # _DarĂ­o Clavijo_, May 23 2025
%K A383968 nonn
%O A383968 1,3
%A A383968 _SiYang Hu_, May 16 2025
%E A383968 a(23)-a(38) from _Sean A. Irvine_, May 21 2025