• 検索結果がありません。

騾カエ髫怜宴ク闃スァ雋橸スス「邵コョ驍ィ?竏ゥ陷キ蛹サ冗クコ?br/>

N/A
N/A
Protected

Academic year: 2021

シェア "騾カエ髫怜宴ク闃スァ雋橸スス「邵コョ驍ィ?竏ゥ陷キ蛹サ冗クコ?br/>"

Copied!
2
0
0

読み込み中.... (全文を見る)

全文

(1)

1

アルゴリズム演習

1

 直角三角形の組み合わせ 

64

直角三角形の成立条件は三平方の定理(別名ピタゴラスの定理)で次のようになります。  さて、直角三角形が成立する最少の組み合わせは、3、4、5ですが、このような組み合 わせを調べて表示するプログラムを作ってみましょう。  a、b、cの各個について総当たりで、a2 = b2+ c2 が成立するか調べ、成立したときに a、b、cの値を表示すればよい訳です。そこで、a、b、cについての3重のループを作り ます。 C言語 河西朝雄著 ナツメ社 64頁 /* 直角三角形の組み合わせ pyth.c */ #include <stdio.h> int main() { int a, b, c, n; printf("最大数 ? "); scanf("%d", &n); printf("A\tB\tC\n"); for(a = 1; a <=n; a++){ for(b = 1; b <= n; b++){ for(c = 1; c <= n; c++){ if(a * a == b * b + c * c){ printf("%d\t%d\t%d\n", a, b, c); } } } } return 0; } 1

(2)

整数論のもう1つのおもな分野は加法的な問題である。この種の問題で最もなじみ深い のは、ある完全平方数を2つの完全平方数の和として表す問題であろう。ピタゴラスの定 理によって、これは、辺の長さが整数の直角3角形を見出す問題と同等である。読者はお そらく(3, 4, 5)や(5, 12, 13)が直角三角形であることは知っていると思う。読者は、こ れらに相似な直角3角形 (6, 8, 10)、(25, 60, 65)など以外は知らないかもしれない。し かし、外にもたくさんある。  (3, 4, 5)と(5, 12, 13)は、どちらも、斜辺が直角の1辺よりも1だけ長い、直角の2 辺をa,b,斜辺をb+1とすると、ピタゴラスの定理によって、 (1)a2+ b2 = (b + 1)2,a2 = b2+ 2b + 1− b2 = 2b + 1 2b + 1は奇数、つまりb + 12 は整数でないから2|/(2b + 1)で、a2 も奇数、したがってa も奇数、よって a = 2n + 1 と置く、(1)から、b = a22−1 = 2(n+1)2 2−1 = 2n2+ 2n 式(2)、(3)で、a, bがnで表されたので 2n + 1,2n2+ 2n,2n2+ 2n + 1 はピタゴラス数だと思われる。 初等整数論 H.スターク著 現代数学社3頁 2

参照

関連したドキュメント

The exception is when the token points downwards at the left output of a primitive operation node (#), and the top three elements of the computation stack have to be checked. Let

There is a bijection between left cosets of S n in the affine group and certain types of partitions (see Bjorner and Brenti (1996) and Eriksson and Eriksson (1998)).. In B-B,

We establish sharp Br´ezis-Gallou¨et-Wainger type inequalities in Besov and Triebel-Lizorkin spaces as well as fractional Sobolev spaces on a bounded domain Ω ⊂ R n.. We treat

(The Elliott-Halberstam conjecture does allow one to take B = 2 in (1.39), and therefore leads to small improve- ments in Huxley’s results, which for r ≥ 2 are weaker than the result

[r]

“Breuil-M´ezard conjecture and modularity lifting for potentially semistable deformations after

S., Oxford Advanced Learner's Dictionary of Current English, Oxford University Press, Oxford

At the end of the section, we will be in the position to present the main result of this work: a representation of the inverse of T under certain conditions on the H¨older