Problem 57998. Easy Sequences 111: Repnums as Hypotenuse of Pythagorean Triangles
For this problem, we'll define a superset of the repunit numbers which we shall call repnums, which are composed of repeated numbers. That is, if we denote repnums by , then x is the number to be repeated and n is the number of repetitions. Hence, , , and so on.
We can see from the figure below that can be a hypotenuse of a right triangle with integer sides (Pythagorean Triangle).
In fact, this is the only Pythagorean triangle that can be formed with hypotenuse equal to . There is also only one Pythagorean triangle with hypotenuse equal to , that is the triangle with sides , while there are seven Pythagorean triangles with hypotenures of , with legs as follows:
Create the function, , that counts the number of Pythagorean triangles that can be formed with hypotenuse equal to .
Solution Stats
Problem Comments
-
1 Comment
David Hill
on 25 May 2023
I think test 2 might be wrong. C(1,1) should be 0, but I believe you are counting it as 1.
Solution Comments
Show commentsProblem Recent Solvers2
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
49326 Solvers
-
336 Solvers
-
Sum the elements in either diagonal of a square matrix
210 Solvers
-
Area of an equilateral triangle
6191 Solvers
-
552 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!