This was Terence Tao's first paper. Tao, recipient of the Fields Me...

Here is Euclid's proof that if $2^n−1$ is prime, then $N=2^{n−1}
(...

If you want to run the this code yourself, Christopher Long upload...

If you want to run this program yourself, David Roberts and Christo...

Additionally, if you want to learn more about Tao's extraordinary m...

PERFECT NUMBERS

A perfect number is one such that all its factors, including one but excluding

itself, add up to itself. For example, 6 is a perfect number since 6 has factors

1, 2, 3 and 6 and 1 + 2 + 3 = 6. In fact, 6 is the smallest perfect number.

Euclid proved in his Elements that a number of the form 2

p−1

(2

p

− 1) is

a perfect number if 2

p

− 1 is a prime number.

I used this fact to write a programme in Basic to ﬁnd perfect numbers but

ﬁrst we need a programme on prime numbers for checking if 2

p

− 1 is prime.

ready.

10 rem prime numbers

11 rem to calculate prime numbers up to a

20 input a

22 if a=2 then print"2": goto 100

25 print"2 3";

30 for i=2 to a

40 if i=a then 100

50 for d=2 to int(sqr(i)+2)

60 if i/d=int(i/d) then 90

70 next d

80 printi;

90 next i

100 end

So now let us see how we can use lines 40-60 to ﬁnd perfect numbers.

10 rem perfect numbers

15 rem to calculate perfect numbers

20 input n

30 if n<6 then print "none":goto 200

35 if n=6 then print "6 only":goto 200

40 print"6";

45 for i=3 to 26

Originally published in Trigon (School Mathematics Journal of the Mathematical Asso-

ciation of South Australia) 21 (3), Nov. 1983, p. 7.

46 rem limit n to 2↑25*(2↑26-1)

47 let y=2↑i-1

50 rem next loop is to check if 2↑i-1 is prime

52 for l=2 to int(sqr(y))

53 if y/l=int(y/l) then 70

54 if y*2↑(i-1)>n then 200

55 next l

57 print",";y*2↑(i-1);

70 next i

200 print

201 print"(this program was written on 26/8/83)"

300 end

Unfortunately, line 45 limits us to 2

25

(2

26

− 1), but then the computer has

a limited range of numbers: it will never get to 2

25

(2

26

− 1) anyway. I have

computed perfect numbers up to 10

13

.

6, 28, 496, 8128, 33 550 336, 8.58986906e + 09, 1.37438691e + 11

The last two, of course, are only approximations to the actual perfect num-

bers and are unacceptable in this form.

8.58986906e + 09 = 8 589 869 060 when the last two ﬁgures are in doubt. In fact

it is 8 589 869 056.

Terence Tao

If you want to run this program yourself, David Roberts and Christopher Long created a repo on Github with the code: https://github.com/DavidMichaelRoberts/Tao_1983/blob/master/perfect.bas
They changed the 'up arrow' notation ↑ in the original code to the modern caret ^.
This was Terence Tao's first paper. Tao, recipient of the Fields Medal in 2006 and one of the greatest living mathematicians submitted this paper to a students' math journal called Trigon at the age of 8.
In this paper, Tao developed a program in BASIC to find perfect numbers.
![](http://static01.nyt.com/images/2015/07/26/magazine/26tao2/26mag-26tao-t_CA0-articleLarge.jpg)
David Roberts and Christopher Long converted the original paper published in Trigon to this LaTeX version.
Additionally, if you want to learn more about Tao's extraordinary mathematical abilities at an early age there's a [really good video by Tibees](https://www.youtube.com/watch?v=I_IFTN2Toak). She explores in depth a report by a researcher of mathematically gifted children that studied Tao at the age of 7.
Here is Euclid's proof that if $2^n−1$ is prime, then $N=2^{n−1}
(2n−1)$ is perfect.
Proof: Clearly the only prime divisors of N are $2^n−1$ and 2. Since $2^n−1$ occurs as a single prime, we have simply that $σ(2^n−1)=(1+(2n−1))=2^n$, and thus
$$
σ(N) = σ(2^{n−1})σ(2^n−1) = \frac{2^n−1}{2-1}2^n=2^n(2^n-1)=2N
$$
So N is perfect!
The task of finding perfect numbers, then, is connected with finding primes of the form $2^n − 1$, also known as Mersenne primes. Mersenne primes were named after
the seventeenth century monk Marin Mersenne, a colleague of Descartes, Fermat and Pascal. Many of the largest known primes are Mersenne primes.
If you want to run the this code yourself, Christopher Long uploaded it to Github: https://github.com/DavidMichaelRoberts/Tao_1983/blob/master/primes.bas