Can anyone tell me how to find largest perfect number less than 10000 in maple? Actually, I know how to find all the perfect numbers less than or equal to 10000 but I don't know how to find the largest one within the same code?
2026-03-27 01:44:28.1774575868
On
find the largest perfect number less than $10,000$ in Maple
212 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
You could use the fact that all known perfect numbers are of the form $n=2^{p-1}(2^p-1)$ where $2^p-1$ is a prime (and hence $p$ is a prime.)
This means that $2n=(2^p)^2-2^p = (2^p-\frac{1}{2})^2-1/4$. So $2^{p}-1$ only needs to be checked up to the value of $\sqrt{20000}\approx 142$, or $p$ only needs to be checked up to $p=7$. Indeed, $127=2^7-1$ is prime, so $2^{6}(2^7-1)=8128$ is the perfect number you are looking for.
Well if you know how to find them all, I suppose you use a loop.
So before your loop add a variable $max=0$. During the loop, for each perfect number $p$ you find, check if $p>max$ and if it is, then do $max=p$.
The value of $max$ after the end of the loop will be the greatest number found ;)