Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7890 > unrolled thread
| Started by | Andrzej Kozlowski <akoz@mimuw.edu.pl> |
|---|---|
| First post | 2012-01-16 12:05 +0000 |
| Last post | 2012-01-16 12:05 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to check whether an infinite set is closed under addition? Andrzej Kozlowski <akoz@mimuw.edu.pl> - 2012-01-16 12:05 +0000
| From | Andrzej Kozlowski <akoz@mimuw.edu.pl> |
|---|---|
| Date | 2012-01-16 12:05 +0000 |
| Subject | Re: How to check whether an infinite set is closed under addition? |
| Message-ID | <jf13r2$5nb$1@smc.vnet.net> |
On 16 Jan 2012, at 02:07, Mobius ReX wrote:
> Sorry the condition of a set A to be closed under addition should be
> `Sum[a_i*n_i ,{i,1,g}] =E2=88=88 A` for any non-negative integer `n_i`, and a_i =E2=88=88 A.
>
> On Sun, Jan 15, 2012 at 5:04 PM, Mobius ReX <aoirex@gmail.com> wrote:
>> Sorry the condition of a set A to be closed under addition should be
>> `a_i*n + a_j*m =E2=88=88 A` for any positive integers `n` and `m` for any a_i =E2=88=88 A.
Of course you are right. Essentially you can use the previous code but you need to add to the base all the multiples of each element of the base that are less than the largest element of the base. In other words, I think the following should work:
closedQ[base_List] :=
Module[{b = Union[Flatten[Table[# i, {i, Last[base]/#}] & /@ base]]},
Complement[
Select[Total[Subsets[Most[b], {2}], {2}], # <= Last[base] &],
base] == {}]
For example:
closedQ[{2, 3, 5, 8}]
False
Andrzej
closedQ[{2, 3, 4, 5, 6, 7, 8}]
True
I am again assuming that the base is sorted.
Andrzej
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web