0
1

More than 1 year has passed since last update.

素数p=x+y (x,yともに1以上)とすると gcd(x,y)=1 らしい

Last updated at Posted at 2022-09-11

gcd(x,y)=1 の図を作る

まず、試しに以下の方法

gifビットマップ用512x512
from math import gcd  # python 3.5 以上

width = 512
bitmap = [int(gcd(x, y) == 1)
          for y in range(1, 1 + width)
          for x in range(1, 1 + width)]

で得た情報から画像を作ります(白は $gcd(x,y)\ne 1$、青は $gcd(x,y)=1$ のドット)
sample-1.gif
$x$ 方向は右で、$y$ 方向は下、画像の座標は左上が $(1, 1)$ です。また、$gcd(x,y)=gcd(y,x)$ で対称です。

左下方向から右上方向への途切れない斜め線を探す

上の図で、$n=x+y$ としたとき、$gcd(x,y)=1$ しかないものを探して赤ドットに変更すると
sample-2.gif
となりました。$n$ を探すプログラム

検索
from math import gcd  # Python 3.5 以上

width = 512

m = ''
for x in range(1, 1 + width * 2):
    u = x
    v = 1
    while u >= v:
        if gcd(u, v) != 1:
            break
        u -= 1
        v += 1
    if u >= v:
        continue
    m += f'{x+1},'
    if len(m) >= 72:
        print(m)
        m = ''
if m:
    print(m)
実行結果
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,
103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,
197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,
307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,
523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,
643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,
761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,
883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,
1019,1021,

が得られたので、これを Mathematica で

Table[Prime[n], {n, 172}] == {
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,
103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,
197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,
307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,
523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,
643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,
761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,
883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,
1019,1021
}

を実行すると True が返ってきました。

何でそうなるのかは分かりませんし、どの範囲まで通用するのかも分かりません。

$gcd(x,y)=m$ で $m\ne1$ なら

p = x + y = m (s + t) = m s + m t \\
x = m s \\
y = m t \\

の場合が存在するので、$p$ は合成数か…

0
1
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
1