Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7879 > unrolled thread

Re: How to check whether an infinite set is closed under addition?

Started byAndrzej Kozlowski <akoz@mimuw.edu.pl>
First post2012-01-16 12:00 +0000
Last post2012-01-16 12:00 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: How to check whether an infinite set is closed under addition? Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2012-01-16 12:00 +0000

#7879 — Re: How to check whether an infinite set is closed under addition?

FromAndrzej Kozlowski <akoz@mimuw.edu.pl>
Date2012-01-16 12:00 +0000
SubjectRe: How to check whether an infinite set is closed under addition?
Message-ID<jf13gi$5ku$1@smc.vnet.net>
On 15 Jan 2012, at 10:51, Rex wrote:

> Given k positive numbers a_1<a_2<a_3<...<a_k, and all integers greater
> than a_k, we want to check whether this set {a_1, a_2, a_3,...a_k, a_k
> + 1, a_k+2, ......} is closed under addition.
> 
> Is there any easy way to do this? any functions that we could use in
> Mathematica?
> 
> Your help will be greatly appreciated.
> 
> 

Let's call your set {a1,a2,...,a3} "base". Then:

closedQ[base_List] := 
 Complement[Select[Total[Subsets[base, {2}], {2}], # <= Max[base] &], 
   base] == {}

For example:

closedQ[{1, 2, 3}]

 True

closedQ[{1, 4, 6, 7}]

False

Andrzej Kozlowski

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web