P540
projecteuler.net

Counting Primitive Pythagorean Triples

ℹ️Published on Sunday, 27th December 2015, 07:00 am; Solved by 736;
Difficulty rating: 30%

A Pythagorean triple consists of three positive integers $a, b$ and $c$ satisfying $a^2+b^2=c^2$.
The triple is called primitive if $a, b$ and $c$ are relatively prime.
Let $P(n)$ be the number of primitive Pythagorean triples with $a \lt b \lt c \le n$.
For example $P(20) = 3$, since there are three triples: $(3,4,5)$, $(5,12,13)$ and $(8,15,17)$.

You are given that $P(10^6) = 159139$.
Find $P(3141592653589793)$.



Soluzione

Last modified: May 01, 2025. Website built with Franklin.jl and the lovely Julia programming language.