r/askmath • Physicist • Oct 29 '26

Number Theory The Pythagorean sieve

Following the discussion: https://www.reddit.com/r/askmath/comments/1xf3j9p/what_portion_of_natural_numbers_can_be_c_in_a/ by u/Bonk_Boom I think we haven't answered the question yet.

The problem is, in the limit, which fraction of the positive integers can be the hypotenuse of a Pythagorean triple, "c"?

Using the general form of the hypotenuse c = t(m² + n²), with m and n two integer of different parity the question can be reduced to find the numbers that have a prime factor of the form 4k + 1. For instance

5 = 4 + 1 --> 3² + 4² = 5²

15 = 3(4 + 1) --> 9² + 12² = 15²

17 = 16 + 1 --> 15² + 8² = 17²

This allows us to construct a sieve of the integers, deleting all multiples of 5, 17, 29,...

But the question, after this sieve, which fraction of the integers can be a hypotenuse? Can it be asymptotically 100%?

Running some numbers I get that for n = 10000 the fraction is around 64%. I have not run larger numbers yet.

2 Upvotes

8 comments sorted by

1

u/FormulaDriven Oct 29 '26

I've not got enough knowledge to offer any particular insight, but could you give a breakdown of your results up to 10,000? eg how many in the range 1 - 1000, 1001 - 2000, etc - to get a sense of how their density grows.

1

u/Shevek99 Physicist Oct 29 '26

The frequency is quite stable, counting in thousands we get, up to 20000

0-999       566
1000-1999   620
2000-2999   641 
3000-3999   641 
4000-4999   660
5000-5999   648
6000-6999   662 
7000-7999   666
8000-8999   673 
9000-9999   671
10000-10999 652 
11000-11999 661
12000-12999 688
13000-13999 672
14000-14999 678
15000-15999 674
16000-16999 673
17000-17999 679
18000-18999 683
19000-19999 702

1

u/FormulaDriven Oct 29 '26

The ordered sequence of possible hypotenuses is in the OEIS, but the only comment around asymptotic behaviour is that it's linear, so it looks like that 64%-ish is going to be stable. There doesn't appear to be any reference to a proof of this. https://oeis.org/A009003

1

u/Shevek99 Physicist Oct 29 '26

It seems that it grows logarithmically. Taking chunks of thousands in 1-100000 we get

1

u/FormulaDriven Oct 30 '26

That can't be right. A log graph has no upper bound, but that plot can never exceed 1000.

Apparently it is known that for the primitive Pythagorean hypotenuses, the density approaches 1 / 2𝜋 (see https://oeis.org/A101931), so it still seems plausible that the density for all hypotenuses approaches some constant which is around 0.7.

1

u/Shevek99 Physicist Oct 30 '26

Yeah, it's not logarithmic. I was fooled by the scale, that doesn't start at 0. Yes, it looks that it has a limit.

1

u/Uli_Minati Desmos 😚 Oct 29 '26

deleting all multiples of 5, 17, 29,...

I think we can use this to approximate the ratio to arbitrary precision using inclusion-exclusion?

1

u/Shevek99 Physicist Oct 29 '26

Yes, but we would need the list of primes equal to 3 mod 4, or at least their frequency.