0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

2次元配列のコラッツ式よりツリー図作成用データを出力してみる

0
Last updated at Posted at 2026-07-03

simple_shiki.jpg
2次元配列のコラッツ式です。
この2式で奇数すべてを表すことができます。
それぞれの式で、s,tは1以上の整数として奇数を表で計算でき、重複も、もれもありません。
(それについては数学的帰納法によって示すことができます)

この式を用いて、ツリー図を逆計算の1から描けるよう、pythonで奇数を羅列してみました。
枝の奇数は5個、深さは4としました。
1本の枝に属する奇数も、深さも、無限です。
3の倍数には枝が接続しません。

実行結果
=======深さ:1=======
1 [5, 21, 85, 341, 1365]
=======深さ: 2 =======
5 [3, 13, 53, 213, 853]
21 [0]
85 [113, 453, 1813, 7253, 29013]
341 [227, 909, 3637, 14549, 58197]
1365 [0]
=======深さ: 3 =======
3 [0]
13 [17, 69, 277, 1109, 4437]
53 [35, 141, 565, 2261, 9045]
213 [0]
853 [1137, 4549, 18197, 72789, 291157]
113 [75, 301, 1205, 4821, 19285]
453 [0]
1813 [2417, 9669, 38677, 154709, 618837]
7253 [4835, 19341, 77365, 309461, 1237845]
29013 [0]
227 [151, 605, 2421, 9685, 38741]
909 [0]
3637 [4849, 19397, 77589, 310357, 1241429]
14549 [9699, 38797, 155189, 620757, 2483029]
58197 [0]
=======深さ: 4 =======
17 [11, 45, 181, 725, 2901]
69 [0]
277 [369, 1477, 5909, 23637, 94549]
1109 [739, 2957, 11829, 47317, 189269]
4437 [0]
35 [23, 93, 373, 1493, 5973]
141 [0]
565 [753, 3013, 12053, 48213, 192853]
2261 [1507, 6029, 24117, 96469, 385877]
9045 [0]
1137 [0]
4549 [6065, 24261, 97045, 388181, 1552725]
18197 [12131, 48525, 194101, 776405, 3105621]
72789 [0]
291157 [388209, 1552837, 6211349, 24845397, 99381589]
75 [0]
301 [401, 1605, 6421, 25685, 102741]
1205 [803, 3213, 12853, 51413, 205653]
4821 [0]
19285 [25713, 102853, 411413, 1645653, 6582613]
2417 [1611, 6445, 25781, 103125, 412501]
9669 [0]
38677 [51569, 206277, 825109, 3300437, 13201749]
154709 [103139, 412557, 1650229, 6600917, 26403669]
618837 [0]
4835 [3223, 12893, 51573, 206293, 825173]
19341 [0]
77365 [103153, 412613, 1650453, 6601813, 26407253]
309461 [206307, 825229, 3300917, 13203669, 52814677]
1237845 [0]
151 [201, 805, 3221, 12885, 51541]
605 [403, 1613, 6453, 25813, 103253]
2421 [0]
9685 [12913, 51653, 206613, 826453, 3305813]
38741 [25827, 103309, 413237, 1652949, 6611797]
4849 [6465, 25861, 103445, 413781, 1655125]
19397 [12931, 51725, 206901, 827605, 3310421]
77589 [0]
310357 [413809, 1655237, 6620949, 26483797, 105935189]
1241429 [827619, 3310477, 13241909, 52967637, 211870549]
9699 [0]
38797 [51729, 206917, 827669, 3310677, 13242709]
155189 [103459, 413837, 1655349, 6621397, 26485589]
620757 [0]
2483029 [3310705, 13242821, 52971285, 211885141, 847540565]
py_code
ii = 5	# 1本の枝で計算したい奇数の個数
jj = 4  # 計算したい深さ

print('=======深さ:1=======')
tmp = []	#いったん根元の奇数を保存するための配列
basetmp = []	  #次の深さで計算する根元の奇数を保存するための配列
line = []	#1本の枝につながる奇数の配列

t = 1

for s in range(2, ii + 2): 	# 列を指定
	b_e = int(((6*t-5)*2**(2*s)-1)/3)
	line.append(b_e) # 計算した数を行に追加
	base = 6*t-5
print(base, line)
basetmp = line

for dep in range(2, jj + 1):
	tmp = basetmp
	basetmp = []
	print('=======深さ:',dep,'=======')
	for nn in range(0, len(tmp)):
		
		line = []
		if  tmp[nn] %  3 == 0 :
			line.append(0) 
			print(int(tmp[nn]), line)

		elif tmp[nn] % 6 == 5 :
			#print('余り5')
			t = int((tmp[nn] + 1) / 6)
			for s in range(1, ii + 1): 	# 列を指定
				b_o = int(((6*t-1)*2**(2*s-1)-1)/3)
				line.append(b_o) # 計算した数を行に追加
				base = int (6*t-1)
				basetmp. append(b_o)	# 行を連結
			print(base, line)

		else:
			#print('余り1')
			t = int((tmp[nn] + 5) / 6)
			for s in range(1, ii + 1): 	# 列を指定
				b_e = int(((6*t-5)*2**(2*s)-1)/3)
				line.append(b_e) # 計算した数を行に追加
				base = int (6*t-5)
				basetmp. append(b_e)	# 行を連結
			print(base, line)

2次元配列によるコラッツ予想の一般化が可能であること、そして、2変数一般項(二重数列)3式で正の偶数全体、正の奇数全体を表わせることで、1から自然数全体へつなげることができることを証明できると考えています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?