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.

A196021 Number of subsets T of S={0,1,2,...,n-1} such that the closure of T under addition modulo n is S.

This page as a plain text file.
%I A196021 #28 Nov 22 2023 22:14:25
%S A196021 1,1,4,5,16,22,64,109,283,486,1189,2174,5097,9528,21904,41549,92022,
%T A196021 177043,387715,754910,1624543,3174095,6751375,13296454,27962241,
%U A196021 55173405,115220461,228121892,472419049,937688232,1930884229,3840200525,7867929073,15660179800
%N A196021 Number of subsets T of S={0,1,2,...,n-1} such that the closure of T under addition modulo n is S.
%F A196021 a(n) >= A058622(n). - _Michael Chu_, Oct 27 2023
%e A196021 For n = 3, each of the four subsets {0,1}, {0,2}, {1,2}, and {0,1,2} has closure {0,1,2} under addition modulo 3 (for example, {0,2} + {0,2} = {0,2,4} = {0,1,2} modulo 3).  Thus a(3) = 4.
%p A196021 sums:= (s, n)-> {seq(seq(irem(i+j, n), j=s), i=s)}:
%p A196021 b:= (i, n, s)-> `if`(sums(s, n) = {$0..(n-1)}, 2^(n-i),
%p A196021                 `if`(i=n, 0, b(i+1, n, s) +b(i+1, n, {s[], i}))):
%p A196021 a:= n-> b(0, n, {}):
%p A196021 seq(a(n), n=1..15);  # _Alois P. Heinz_, Oct 21 2011
%o A196021 (Python)
%o A196021 def sums(s, n):
%o A196021     return sorted(set((si+sj)%n for i, si in enumerate(s) for sj in s[i:]))
%o A196021 def b(i, n, s):
%o A196021     if sums(s, n) == list(range(n)): return 2**(n-i)
%o A196021     if i == n: return 0
%o A196021     return b(i+1, n, s) + b(i+1, n, sorted(set(s+[i])))
%o A196021 def a(n): return b(0, n, [])
%o A196021 print([a(n) for n in range(1, 19)]) # _Michael S. Branicky_, Jan 09 2022 after _Alois P. Heinz_
%K A196021 nonn
%O A196021 1,3
%A A196021 _John W. Layman_, Sep 26 2011
%E A196021 a(21)-a(28) from _Alois P. Heinz_, Oct 21 2011
%E A196021 a(29)-a(34) from _Michael S. Branicky_, Jan 09 2022