A143823
Number of subsets {x(1),x(2),...,x(k)} of {1,2,...,n} such that all differences |x(i)-x(j)| are distinct.
Original entry on oeis.org
1, 2, 4, 7, 13, 22, 36, 57, 91, 140, 216, 317, 463, 668, 962, 1359, 1919, 2666, 3694, 5035, 6845, 9188, 12366, 16417, 21787, 28708, 37722, 49083, 63921, 82640, 106722, 136675, 174895, 222558, 283108, 357727, 451575, 567536, 712856, 890405, 1112081, 1382416, 1717540
Offset: 0
{1,2,4} is a subset of {1,2,3,4}, with distinct differences 2-1=1, 4-1=3, 4-2=2 between pairs of elements, so {1,2,4} is counted as one of the 13 subsets of {1,2,3,4} with the desired property. Only 2^4-13=3 subsets of {1,2,3,4} do not have this property: {1,2,3}, {2,3,4}, {1,2,3,4}.
From _Gus Wiseman_, May 17 2019: (Start)
The a(0) = 1 through a(5) = 22 subsets:
{} {} {} {} {} {}
{1} {1} {1} {1} {1}
{2} {2} {2} {2}
{1,2} {3} {3} {3}
{1,2} {4} {4}
{1,3} {1,2} {5}
{2,3} {1,3} {1,2}
{1,4} {1,3}
{2,3} {1,4}
{2,4} {1,5}
{3,4} {2,3}
{1,2,4} {2,4}
{1,3,4} {2,5}
{3,4}
{3,5}
{4,5}
{1,2,4}
{1,2,5}
{1,3,4}
{1,4,5}
{2,3,5}
{2,4,5}
(End)
The integer partition case is
A325858.
The strict integer partition case is
A325876.
Heinz numbers of the counterexamples are given by
A325992.
Cf.
A000079,
A108917,
A143824,
A169942,
A308251,
A325676,
A325677,
A325679,
A325683,
A325860,
A325864,
A241688,
A241689,
A241690.
-
b:= proc(n, s) local sn, m;
if n<1 then 1
else sn:= [s[], n];
m:= nops(sn);
`if`(m*(m-1)/2 = nops(({seq(seq(sn[i]-sn[j],
j=i+1..m), i=1..m-1)})), b(n-1, sn), 0) +b(n-1, s)
fi
end:
a:= proc(n) option remember;
b(n-1, [n]) +`if`(n=0, 0, a(n-1))
end:
seq(a(n), n=0..30); # Alois P. Heinz, Sep 14 2011
-
b[n_, s_] := Module[{ sn, m}, If[n<1, 1, sn = Append[s, n]; m = Length[sn]; If[m*(m-1)/2 == Length[Table[sn[[i]] - sn[[j]], {i, 1, m-1}, {j, i+1, m}] // Flatten // Union], b[n-1, sn], 0] + b[n-1, s]]]; a[n_] := a[n] = b[n - 1, {n}] + If[n == 0, 0, a[n-1]]; Table [a[n], {n, 0, 30}] (* Jean-François Alcover, Nov 08 2015, after Alois P. Heinz *)
Table[Length[Select[Subsets[Range[n]],UnsameQ@@Abs[Subtract@@@Subsets[#,{2}]]&]],{n,0,15}] (* Gus Wiseman, May 17 2019 *)
-
from itertools import combinations
def is_sidon_set(s):
allsums = []
for i in range(len(s)):
for j in range(i, len(s)):
allsums.append(s[i] + s[j])
if len(allsums)==len(set(allsums)):
return True
return False
def a(n):
sidon_count = 0
for r in range(n + 1):
subsets = combinations(range(1, n + 1), r)
for subset in subsets:
if is_sidon_set(subset):
sidon_count += 1
return sidon_count
print([a(n) for n in range(20)]) # Sayan Dutta, Feb 15 2024
-
from functools import cache
def b(n, s):
if n < 1: return 1
sn = s + [n]
m = len(sn)
return (b(n-1, sn) if m*(m-1)//2 == len(set(sn[i]-sn[j] for i in range(m-1) for j in range(i+1, m))) else 0) + b(n-1, s)
@cache
def a(n): return b(n-1, [n]) + (0 if n==0 else a(n-1))
print([a(n) for n in range(31)]) # Michael S. Branicky, Feb 15 2024 after Alois P. Heinz
A169942
Number of Golomb rulers of length n.
Original entry on oeis.org
1, 1, 3, 3, 5, 7, 13, 15, 27, 25, 45, 59, 89, 103, 163, 187, 281, 313, 469, 533, 835, 873, 1319, 1551, 2093, 2347, 3477, 3881, 5363, 5871, 8267, 9443, 12887, 14069, 19229, 22113, 29359, 32229, 44127, 48659, 64789, 71167, 94625, 105699, 139119, 151145, 199657
Offset: 1
For n=2, there is one Golomb Ruler: {0,2}. For n=3, there are three: {0,3}, {0,1,3}, {0,2,3}. - _Tomas Boothby_, May 15 2012
From _Gus Wiseman_, May 16 2019: (Start)
The a(1) = 1 through a(8) = 15 compositions such that every restriction to a subinterval has a different sum:
(1) (2) (3) (4) (5) (6) (7) (8)
(12) (13) (14) (15) (16) (17)
(21) (31) (23) (24) (25) (26)
(32) (42) (34) (35)
(41) (51) (43) (53)
(132) (52) (62)
(231) (61) (71)
(124) (125)
(142) (143)
(214) (152)
(241) (215)
(412) (251)
(421) (341)
(512)
(521)
(End)
Cf.
A000079,
A103295,
A103300,
A108917,
A143824,
A325466,
A325545,
A325676,
A325678,
A325679,
A325683,
A325686.
-
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],UnsameQ@@ReplaceList[#,{_,s__,_}:>Plus[s]]&]],{n,15}] (* Gus Wiseman, May 16 2019 *)
-
def A169942(n):
R = QQ['x']
return sum(1 for c in cartesian_product([[0, 1]]*n) if max(R([1] + list(c) + [1])^2) == 2)
[A169942(n) for n in range(1,8)]
# Tomas Boothby, May 15 2012
A036501
Number of inequivalent Golomb rulers with n marks and shortest length.
Original entry on oeis.org
1, 1, 1, 2, 4, 5, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 2
A241688
Number of Sidon subsets of {1,...,n} of size 4.
Original entry on oeis.org
0, 0, 0, 0, 0, 0, 2, 10, 26, 60, 110, 190, 304, 466, 676, 958, 1312, 1762, 2310, 2984, 3786, 4750, 5874, 7196, 8720, 10484, 12488, 14780, 17360, 20276, 23530, 27174, 31210, 35696, 40630, 46074, 52032, 58566, 65676, 73434, 81840, 90966, 100814, 111460, 122906
Offset: 1
a(7)=2 since the only subsets of {1,...,7} satisfying the required conditions are {1,2,5,7} and {1,3,6,7}.
- Index entries for linear recurrences with constant coefficients, signature (2, 0, -1, 0, -2, 2, 0, 1, 0, -2, 1).
-
SidonQ[l__] := If[Length[Join[Plus @@@ Subsets[l, {2}], 2 l]] == Length[Union[Join[Plus @@@ Subsets[l, {2}], 2 l]]], True, False]
Table[Length@Select[Subsets[Range[n], {4}], SidonQ[#] &], {n, 1, 30}]
A241689
Number of Sidon subsets of {1,...,n} of size 5.
Original entry on oeis.org
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 22, 68, 156, 320, 584, 1008, 1622, 2520, 3734, 5428, 7612, 10488, 14126, 18744, 24390, 31436, 39914, 50212, 62390, 76932, 93918, 113960, 137058, 163896, 194632, 229988, 270018, 315712, 367106, 425220, 490164, 563080, 644096
Offset: 1
a(12)=4 since the only subsets of {1,...,12} satisfying the required conditions are {1,2,5,10,12}, {1,3,8,9,12}, {1,3,8,11,12}, and {1,4,5,10,12}.
-
SidonQ[l__] := If[Length[Join[Plus @@@ Subsets[l, {2}], 2 l]] == Length[Union[Join[Plus @@@ Subsets[l, {2}], 2 l]]], True, False]
Table[Length@Select[Subsets[Range[n], {5}], SidonQ[#] &], {n, 1, 30}]
A241690
Number of Sidon subsets of {1,...,n} of size 6.
Original entry on oeis.org
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 24, 80, 206, 504, 1004, 1910, 3380, 5688, 9036, 14106, 21190, 31158, 44370, 62206, 85308, 115662, 153746, 202146, 262156, 336960, 427488, 538690, 671604, 831926, 1021238, 1246604, 1510056, 1820580, 2179480
Offset: 1
a(18)=8 since there are 8 subsets of {1,...,18} satisfying the required conditions, for example {1,2,5,11,13,18}.
-
SidonQ[l__] := If[Length[Join[Plus @@@ Subsets[l, {2}], 2 l]] == Length[Union[Join[Plus @@@ Subsets[l, {2}], 2 l]]], True, False]
Table[Length@Select[Subsets[Range[n], {6}], SidonQ[#] &], {n, 1, 30}]
A275672
Size of a largest subset of a regular cubic lattice of n*n*n points without repeated distances.
Original entry on oeis.org
0, 1, 3, 4, 6, 7, 9
Offset: 0
For n = 5, a(5) >= 7 is witnessed by {(1,1,1), (1,1,2), (1,1,4), (1,2,5), (2,3,1), (4,4,5), (5,5,4)}. There are 4223 distinct (up to rotation and reflection) 7-point configurations without repeated distances, and none of them can be extended to 8 points, so a(5) = 7.
Showing 1-7 of 7 results.
Comments