## Search found 5 matches

Sun Apr 29, 2012 5:08 am
Forum: Number
Topic: Question regarding pythagorean triplets
Replies: 3
Views: 3158

### Re: Question regarding pythagorean triplets

It also true that m2+n2 is always greater than the other two?
Sat Apr 28, 2012 7:04 pm
Forum: Number
Topic: Question regarding pythagorean triplets
Replies: 3
Views: 3158

### Question regarding pythagorean triplets

Pythagorean triplets have a property that they can be expressed in the form of m2-n2, 2mn, m2+n2 (where m>n). I have the following questions -
Does 2mn>m2-n2 always hold?
Do m,n belong to natural numbers?

Thanks in advance.
Fri Apr 27, 2012 6:12 am
Forum: Discrete Mathematics
Topic: Finding permutations of any 3-digit number
Replies: 4
Views: 8163

### Re: Finding permutations of any 3-digit number

Yeah! That's what I was exactly going to suggest before I saw your post. And now I've solved my problem. Did the following - seq[3]={ones_digit,tens_digit,hundreds_digit} for (int i=0;i<=2;i++) Output seq[i], seq[(i+1)%3], seq[(i+2)%3] Output seq[i], swap(seq[(i+1)%3],seq[(i+2)%3]) //Where 'swap' wi...
Thu Apr 26, 2012 8:14 am
Forum: Discrete Mathematics
Topic: Finding permutations of any 3-digit number
Replies: 4
Views: 8163

### Re: Finding permutations of any 3-digit number

[quote="jaap"]You'll need to use some data structure like an array or a list (or even a string) so that you can access those digits individually by index number, rather than by specific variable names for each digit. That way the digits will be something like digit[1], digit[2], and digit[3] (or di...
Thu Apr 26, 2012 7:32 am
Forum: Discrete Mathematics
Topic: Finding permutations of any 3-digit number
Replies: 4
Views: 8163

### Finding permutations of any 3-digit number

Now I was working on this problem in school where I had to list out all possible permutations of a given three digit number. Here's my code - Output "Enter a three-digit number: " Input no hundreds_digit=no/100, ones_digit=no%10, tens_digit=no/10-10*hundreds_digit Now I've got the one's, ten's and t...