指数表現((a/b)c の形で表される数)に関する数学パズルを Python で強引に解く.
a,b,c,d,e,f は 1 以上 10 以下の相異なる整数とする.
(a/b)c / (d/e)f ができるだけ 1 に近くなる a,b,c,d,e,f を求めよ.
(元の問題: "Simplifying Exponential Expressions" https://twitter.com/hyuki/status/1105380734699679744 )
Python で全 10P6 通り(=151200 通り)をすべて計算した.
解答は以下の 40 通りあり, すべて 1 に等しい.
(6/3)10 / (4/1)5 = 1
(3/6)10 / (1/4)5 = 1
(4/1)5 / (6/3)10 = 1
(1/4)5 / (3/6)10 = 1
(6/3)10 / (8/2)5 = 1
(3/6)10 / (2/8)5 = 1
(8/2)5 / (6/3)10 = 1
(2/8)5 / (3/6)10 = 1
(10/5)6 / (4/1)3 = 1
(5/10)6 / (1/4)3 = 1
(4/1)3 / (10/5)6 = 1
(1/4)3 / (5/10)6 = 1
(10/5)6 / (8/2)3 = 1
(5/10)6 / (2/8)3 = 1
(8/2)3 / (10/5)6 = 1
(2/8)3 / (5/10)6 = 1
(4/2)9 / (8/1)3 = 1
(2/4)9 / (1/8)3 = 1
(8/1)3 / (4/2)9 = 1
(1/8)3 / (2/4)9 = 1
(10/5)6 / (8/1)2 = 1
(5/10)6 / (1/8)2 = 1
(8/1)2 / (10/5)6 = 1
(1/8)2 / (5/10)6 = 1
(10/5)9 / (8/1)3 = 1
(5/10)9 / (1/8)3 = 1
(8/1)3 / (10/5)9 = 1
(1/8)3 / (5/10)9 = 1
(6/2)8 / (9/1)4 = 1
(2/6)8 / (1/9)4 = 1
(9/1)4 / (6/2)8 = 1
(1/9)4 / (2/6)8 = 1
(6/2)10 / (9/1)5 = 1
(2/6)10 / (1/9)5 = 1
(9/1)5 / (6/2)10 = 1
(1/9)5 / (2/6)10 = 1
(3/2)10 / (9/4)5 = 1
(2/3)10 / (4/9)5 = 1
(9/4)5 / (3/2)10 = 1
(4/9)5 / (2/3)10 = 1
任意の a,b,c,d,e,f について,
(a/b)c / (d/e)f = (e/d)f / (b/a)c が成り立つ(単純な例:2/3 = (1/3)/(1/2)).
また, X/Y = 1 なら Y/X = 1 である.
したがって, (a/b)c / (d/e)f = 1 が成り立つとき
(b/a)c / (e/d)f = 1,
(d/e)f / (a/b)c = 1,
(e/d)f / (b/a)c = 1
はすべて成り立つ.
上記の 40 通りにこれらが含まれることを考慮すると, 解答は以下の 4 型, 計 10 通りに大別される.
第 1 型: 「4n = 22n」型(4 通り)
(4/1)3 / (10/5)6 = 1
(4/1)5 / (6/3)10 = 1
(8/2)3 / (10/5)6 = 1
(8/2)5 / (6/3)10 = 1
第 2 型: 「8n = 23n」型(3 通り)
(8/1)2 / (10/5)6 = 1
(8/1)3 / (4/2)9 = 1
(8/1)3 / (10/5)9 = 1
第 3 型: 「9n = 32n」型(2 通り)
(9/1)4 / (6/2)8 = 1
(9/1)5 / (6/2)10 = 1
第 4 型: 「(9/4)n = (3/2)2n」型(1 通り)
(9/4)5 / (3/2)10 = 1
その1: ぴったり 1 にはならないが最も 1 に近い答は
(8/2)1 / (7/6)9 = 0.9989388...
である(複数の別解がある).
これは (7/6)9 が 4 に非常に近い値を取る(= 4.004249...)ことによる.
その2: 逆に最も 1 から遠い答は
(8/1)10 / (2/7)9 = 84627647627264.05...
である. 分子をなるべく大きく, 分母をなるべく小さくすることで得られる.