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.

A382399 Number of subsets of Z_n such that every ordered pair of distinct elements has a different difference.

This page as a plain text file.
%I A382399 #12 Mar 27 2025 18:33:31
%S A382399 1,2,3,7,9,16,19,43,49,100,91,177,193,352,323,691,673,1242,1135,2129,
%T A382399 2041,3634,3103,5843,5473,9326,8139,16579,14001,24796,21271,38813,
%U A382399 34369,60292,49539,86451,81361,131684,110391,196717,171761,286878,236167,419337,370569,618346,501999,872415,763777,1235438,1028451
%N A382399 Number of subsets of Z_n such that every ordered pair of distinct elements has a different difference.
%C A382399 Arithmetic is done modulo n.
%C A382399 Also the number of subsets of Z_n such that every unordered pair of (not necessarily distinct) elements has a different sum.
%H A382399 Andrew Howroyd, <a href="/A382399/b382399.txt">Table of n, a(n) for n = 0..80</a>
%H A382399 Wikipedia, <a href="https://en.wikipedia.org/wiki/Sidon_sequence">Sidon sequence</a>.
%H A382399 <a href="/index/Go#Golomb">Index entries for sequences related to Golomb rulers</a>.
%F A382399 a(n) = n*A325681(n) + 1.
%e A382399 The a(0) = 1 through a(5) = 16 subsets:
%e A382399   {}  {}   {}     {}     {}       {}
%e A382399       {0}  {0}    {0}    {0}      {0}
%e A382399            {1}    {1}    {1}      {1}
%e A382399                   {2}    {2}      {2}
%e A382399                   {0,1}  {3}      {3}
%e A382399                   {0,2}  {0,1}    {4}
%e A382399                   {1,2}  {0,3}    {0,1}
%e A382399                          {1,2}    {0,2}
%e A382399                          {2,3}    {0,3}
%e A382399                                   {0,4}
%e A382399                                   {1,2}
%e A382399                                   {1,3}
%e A382399                                   {1,4}
%e A382399                                   {2,3}
%e A382399                                   {2,4}
%e A382399                                   {3,4}
%o A382399 (PARI)
%o A382399 a(n)={
%o A382399    my(recurse(k,r,b,w)=
%o A382399       if(k >= n, 1,
%o A382399          b+=1<<k;
%o A382399          my(t=bitand((1<<n)-1, bitor(b<<k, b<<(k-n))));
%o A382399          self()(k+1, r, b-(1<<k), w) +
%o A382399             if(!bitand(w,t), self()(k+1, r+1, b, w + t));
%o A382399        ));
%o A382399    recurse(0,0,0,0);
%o A382399 }
%Y A382399 Cf. A143823, A325679, A325681, A382400.
%K A382399 nonn
%O A382399 0,2
%A A382399 _Andrew Howroyd_, Mar 24 2025