2007-02-28から1日間の記事一覧

ゴールドバッハ予想。

Goldbach's Conjecture In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: (A) Every number greater than 2 can be written as the sum of three prime numbers.…

数値

C++

double は超でかい数字まで扱える。(1.7e+308 ぐらい)double x に対し、scanf("%lf", &x) や cin >> x で、普通に "46215734612859298473242134234352452346" のような整数を数値として読み込める。double つえー。

約数の個数の偶奇判定。

問題 input: 整数 n output: k = 整数 n の約数の個数 とする。このとき k が奇数ならば yes, 偶数ならば no n の約数を並べてみると、 となる。ここでポイントになるのが次の命題 任意の について が成り立つ。 つまり、約数列の前から i 番目と後ろから i …