Skip to main content
added 96 characters in body
Source Link
Fatalize
  • 39.3k
  • 5
  • 70
  • 162

#Brachylog, 13 bytes

'(p:?+L:?x'L)

###Explanation

This checks that there is no permutation of the input such that when you add each element to each corresponding element of the input, no element of that resulting sum is in the input.

'(          )  True if what's in the parentheses is impossible, false otherwise
  p            Get a permutation of Input
   :?+L        L is the list of element-wise sums of the permutation with Input
       :?x'L   There is at least one element of Input in L

#Brachylog, 13 bytes

'(p:?+L:?x'L)

###Explanation

This checks that there is no permutation of the input such that when you add each element to each corresponding element of the input, no element of that resulting sum is in the input.

#Brachylog, 13 bytes

'(p:?+L:?x'L)

###Explanation

'(          )  True if what's in the parentheses is impossible, false otherwise
  p            Get a permutation of Input
   :?+L        L is the list of element-wise sums of the permutation with Input
       :?x'L   There is at least one element of Input in L
Post Undeleted by Fatalize
deleted 220 characters in body
Source Link
Fatalize
  • 39.3k
  • 5
  • 70
  • 162

#Brachylog, 1713 bytes

'(s[Ap:B]+~m[?+L:I])

or

'(sSl2,S+~m[?:I]x'L)

or

:{s[A:B]+.}f:?rx?

or even

:{s[A:B]+.}fF:?xF

Can't get less than 17 bytes…

###Explanation

The first two programs basically say “Prove that no subset of 2 elements of the input exists such that its sum is in the Input”.

The last two programs say “Find all sums of subsets of 2 elements of the input, none of the elements of that list are in the input”This checks that there is no permutation of the input such that when you add each element to each corresponding element of the input, no element of that resulting sum is in the input.

#Brachylog, 17 bytes

'(s[A:B]+~m[?:I])

or

'(sSl2,S+~m[?:I])

or

:{s[A:B]+.}f:?rx?

or even

:{s[A:B]+.}fF:?xF

Can't get less than 17 bytes…

###Explanation

The first two programs basically say “Prove that no subset of 2 elements of the input exists such that its sum is in the Input”.

The last two programs say “Find all sums of subsets of 2 elements of the input, none of the elements of that list are in the input”.

#Brachylog, 13 bytes

'(p:?+L:?x'L)

###Explanation

This checks that there is no permutation of the input such that when you add each element to each corresponding element of the input, no element of that resulting sum is in the input.

Post Deleted by Fatalize
Source Link
Fatalize
  • 39.3k
  • 5
  • 70
  • 162

#Brachylog, 17 bytes

'(s[A:B]+~m[?:I])

or

'(sSl2,S+~m[?:I])

or

:{s[A:B]+.}f:?rx?

or even

:{s[A:B]+.}fF:?xF

Can't get less than 17 bytes…

###Explanation

The first two programs basically say “Prove that no subset of 2 elements of the input exists such that its sum is in the Input”.

The last two programs say “Find all sums of subsets of 2 elements of the input, none of the elements of that list are in the input”.