Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

How many distinct integers between 0 and 16 can one pick so that all positive differences are distinct?

If k is the number of distinct integers, the number of positive differences is

1+2+…+(k-1) = k(k-1)/2,

which cannot exceed 16, meaning k cannot exceed 6. From there, picking 6 integers at random makes it easy to check for the condition:

x=sort(sample(0:16,6))
y=outer(x[-1],x[-6],"-")
while (max(duplicated(y[lower.tri(y)]))==1){
x=sort(sample(0:16,6))
y=outer(x[-1],x[-6],"-")}

which quickly returns

> x
[1] 0 1 5 9 12 15

as a solution. Now, reading the puzzle solution of Le Monde today, on September 09, I discovered that the authors proposed a sequence of length 7, (0,1,2,4,5,7,11,16), which does not work since 1-0=2-1… and proved that 8 is an impossible value by quite a convoluted argument. Did I misread again?!