- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the 3 Pythagorean triplets with only one number?
Given: Pythagorean triplets
To explain: Here we have to explain how to find Pythagorean triplets with only one number.
Solution:
If the number is odd:
Square the number (n) and then divide it by 2.
Take the integer that is immediately before and after that number
i.e. $\left(\frac{n^{2}}{2} \ -\ 0.5\right)$ and $\left(\frac{n^{2}}{2} \ +\ 0.5\right)$.
Pythagorean triplet = n, $\left(\frac{n^{2}}{2} \ -\ 0.5\right)$ and $\left(\frac{n^{2}}{2} \ +\ 0.5\right)$.
Example:
Take number n = 3.
On squaring the number, we get 9.
Now take half of it: $\frac{9}{2}$ = 4.5
The integer immediately before 4.5 = 4
The integer immediately after 4.5 = 5
Therefore, the triplets are 3, 4 and 5.
If the number is even:
Take the half of that number (n) and then square it.
Pythagorean triplet = n, $\left(\frac{n}{2}\right)^{2} \ -\ 1$ and $\left(\frac{n}{2}\right)^{2} \ +\ 1$
Example:
Take number n = 8
Half of n = 4.
Pythagorean triplet = 8, (42 $-$ 1) and (42 $+$ 1) = 8, 15 and 17.
- Related Articles
- Write a Pythagorean triplets whose one number is $40$.
- What are Pythagorean triplets ?
- Write two Pythagorean triplets each having one of the numbers as 5.
- Check whether the following triplets are Pythagorean Triplets:- $( 5,\ 12,\ 13)$.
- Identify, with reason, which of the following are Pythagorean triplets.(1) (24,70,74) (2) (10,24,27) (3) (11,60,61)
- Python Program to Determine all Pythagorean Triplets in the Range
- Program to check if the given list has Pythagorean Triplets or not in Python
- Find n’th number in a number system with only 3 and 4 in C++
- The two numbers of a Pythagorean triplet are 100 and 2499. Find the third number of this Pythagorean triplet.
- Program to find number of good triplets in Python
- How to multiply only one column in an R data frame with a number?
- Count number of triplets with product equal to given number in C++
- Count number of triplets with product equal to given number with duplicates allowed in C++
- JavaScript Program to Find all triplets with zero sum
- Convert to number with digits as 3 and 8 only in C++
