Forgot password?
 Register account
View 1905|Reply 11

[组合] 均有一个元素是另两个元素的和

[Copy link]

413

Threads

1431

Posts

110K

Credits

Credits
11100

Show all posts

realnumber Posted 2015-6-8 20:15 |Read mode
Last edited by realnumber 2022-9-18 14:28北京李-- 2015/6/6 12:27:04
1至12k能否划分成4k个互不相交的三元集合,满足对于每一个三元集合,均有一个元素是另两个元素的和

k=1,2都可以
k=1
1,10,11;
2,5,7;
3,6,9;
4,8,12.
k=1  另一种1,8,9;  2,10,12;   3,4,7;  5,6,11.
k=2也可以
1,22,23;    2,19,21;
3,8,11;     4,13,17;
5,15,20;    6,12,18;
7,9,16;    10,14,24;

413

Threads

1431

Posts

110K

Credits

Credits
11100

Show all posts

 Author| realnumber Posted 2015-6-8 20:18
西西:只要一个数按除以4(或者-3除以4)能转到3都可以
意思是说若k满足 归纳易得4k或4k+3都行
QQ图片20150608201709--1.png
QQ图片20150608201721--2.png

还在看,好象不好懂.

413

Threads

1431

Posts

110K

Credits

Credits
11100

Show all posts

 Author| realnumber Posted 2015-6-8 20:51
Last edited by realnumber 2015-6-16 19:27西西:
所以还没有完全解决这个问题 但是如果初值可以确定越多 那么就可以确定哪些可以分


1~27构成的集合也可以划分,如下:
\begin{pmatrix} 3&5&7&9&11&  1&2&8&10\\ 16&15&14&13&12&24&4&18&17\\ 19&20&21&22&23&25&6&26&27\end{pmatrix}

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-14 20:00
realnumber 发表于 2015-6-8 13:18
西西:只要一个数按除以4(或者-3除以4)能转到3都可以
意思是说若k满足 归纳易得4k或4k+3都行

  1. For[S = {}; n = 2, n < 100, m = ++n;
  2. While[m > 3 && Divisible[m (m - 3), 4],
  3.   If[Divisible[m, 4], m /= 4, m = (m - 3)/4]],
  4. If[m == 3, AppendTo[S, n]]]; S
Copy the Code
39407f41181.png
小于100的能转到3的数为 $3, 12, 15, 48, 51, 60, 63$
发现这是oeis.org/A001196

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-14 20:04
Last edited by hbghlyj 2022-9-15 11:06
realnumber 发表于 2015-6-8 13:51
西西:
所以还没有完全解决这个问题 但是如果初值可以确定越多 那么就可以确定哪些可以分

转到27也算进去,得到<200的数为 $3, 12, 15, 27, 48, 51, 60, 63, 108, 111, 192, 195$
39407f41181.png

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-14 20:45
  1. f[{}] := True;
  2. f[S_] :=
  3.   With[{c = Max[S]},
  4.    If[Length[S] < 3 || c < 3, False,
  5.     AnyTrue[Map[Complement[S, {#, c - #, c}] &,
  6.       Select[S, # <= (c - 1)/2 && MemberQ[S, c - #] &]], f]]];
  7. Select[Range[3, 25], f@*Range]
Copy the Code
≤25的$n$有: 3, 12, 15, 24
哇, 发现24也可以

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-14 21:22
hbghlyj 发表于 2022-9-14 13:45
≤25的$n$有: 3, 12, 15, 24
哇, 发现24也可以
39407f41181.png
上图显示全部分法, 其中一种是
\begin{matrix} 1 & 3 & 5 & 8 & 4 & 7 & 6 & 2 \\
23 & 19 & 16 & 12 & 14 & 10 & 9 & 11 \\
24 & 22 & 21 & 20 & 18 & 17 & 15 & 13 \end{matrix}
  1. g[S_ /; Length[S] < 3] := {};
  2. g[{a_, b_, c_}] := If[c == a + b, {{{{a, b, c}}}}, {}];
  3. g[S_] :=
  4.   With[{c = Max[S]},
  5.    If[c < 3, False,
  6.     Union[Map[(T = g[Complement[S, {#, c - #, c}]];
  7.         If[T != {},
  8.          Function[x, {{#, c - #, c}, Splice[x]}] /@ Flatten[T, 1],
  9.          Nothing]) &,
  10.       Select[S, # <= (c - 1)/2 && MemberQ[S, c - #] &]]]]];
  11. g[Range[24]]
Copy the Code

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-15 01:22
39407f41181.png
将7#代码稍加优化, 搜索形如$12k,12k+3$的数:
  1. f[{a_, b_, c_}] := a + b == c;
  2. f[S_] :=
  3.   Block[{c = S[[Length[S]]], p, p1, T1, T2},
  4.    p = FirstPosition[Delete[S, -1] - (c - 1)/2, n_ /; Positive[n]];
  5.    If[c < 3 || MissingQ[p], Return[False]];
  6.    p1 = p[[1]];
  7.    T1 = S[[1 ;; p1 - 1]]; T2 = S[[p1 ;;]];
  8.    AnyTrue[
  9.     Map[Complement[S, {#, c - #, c}] &,
  10.      Select[T1, MemberQ[T2, c - #] &]], f]];
Copy the Code
红色数字为未确定者:
3, 12, 15, 24, 27, 36, 39, 48, 51, 60, 63, 72, 75, 84, 87, 96, 99, 108, 111, ⋯

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-15 02:02
8#代码是求出所有组合,下面是只求出一个组合就终止程序:
39407f41181.png
\begin{matrix}
n=36&\left(\begin{array}c
6 & 8 & 4 & 7 & 12 & 11 & 10 & 9 & 5 & 3 & 2 & 1 \\
15 & 14 & 19 & 17 & 13 & 16 & 18 & 20 & 26 & 30 & 32 & 35 \\
21 & 22 & 23 & 24 & 25 & 27 & 28 & 29 & 31 & 33 & 34 & 36
\end{array}\right)\\
n=39&\left(\begin{array}c
7 & 5 & 8 & 6 & 13 & 12 & 11 & 10 & 9 & 4 & 3 & 2 & 1 \\
15 & 19 & 17 & 20 & 14 & 16 & 18 & 21 & 23 & 30 & 33 & 35 & 38 \\
22 & 24 & 25 & 26 & 27 & 28 & 29 & 31 & 32 & 34 & 36 & 37 & 39
\end{array}\right)\end{matrix}
  1. f[{a_, b_, c_}] :=
  2.   If[a + b == c, {a1, b1, c1} = {a, b, c}; Return[True],
  3.    Return[False]];
  4. f[S_] :=
  5.   Block[{c = S[[Length[S]]], p, p1, T1, T2},
  6.    p = FirstPosition[Delete[S, -1] - (c - 1)/2, n_ /; Positive[n]];
  7.    If[c < 3 || MissingQ[p], Return[False]];
  8.    p1 = p[[1]];
  9.    T1 = S[[1 ;; p1 - 1]]; T2 = S[[p1 ;;]];
  10.    AnyTrue[
  11.     Map[Complement[S, {#, c - #, c}] &,
  12.      Select[T1, MemberQ[T2, c - #] &]], f]];
  13. g[{}] := {};
  14. g[S_] :=
  15.   If[f[S], {{a1, b1, c1}, Splice[g[Complement[S, {a1, b1, c1}]]]}];
  16. g[Range[39]] // Transpose // TeXForm
Copy the Code

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-15 02:51

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-15 17:57
A108235  Number of partitions of {1,2,...,3n} into n triples (X,Y,Z) each satisfying X+Y=Z.
  1. MapIndexed[
  2. Function[{n, i}, If[n != 0, 3 i[[1]], Nothing]],
  3. {1, 0, 0, 8, 21, 0, 0, 3040, 20505, 0, 0, 10567748, 103372655, 0, 0, 142664107305, 1836652173363, 0, 0}
  4. ]
Copy the Code
{3, 12, 15, 24, 27, 36, 39, 48, 51}

3159

Threads

7941

Posts

610K

Credits

Credits
63770
QQ

Show all posts

hbghlyj Posted 2022-9-15 18:40
可以标记“已解决”了

Mobile version|Discuz Math Forum

2025-5-31 10:57 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit