Three programs by Terence Tao, aged 6 (or 7)

We find three Basic programs in a short piece from an educationalist on a child prodigy, as he then was:
Terence Tao, at 8 years old (1984) as posted on HN

For orientation, perhaps see Numberphile’s video
The World’s Best Mathematician (*)

Here’s the first one, which you can run here in @NoLand’s PET emulator. I’ve pasted it as-is, lower case and all:

8 print "J"
10 print "here comes mr. fibonacci"
20 print "can you guess which year was mr. fibonacci born?"
30 print "write down a number please... ": inputc
31 ifc = 1170 then print "you are correct! now we start": go to 150
50 if c > 1250 then print "no, he is already in heaven, try again": go to 30
60 if c < 1170 then print "sorry, he wasn't born yet! try again": go to 30
70 if c > 1170 < 1250 then print "he would be ";c-1170;" years old"
71 print "now can you guess?": input c
72 if c = 1170 then 31
73 print "you are wrong. try again.": go to 71
150 print "up to which number do you want me tell you all the fibonacci numbers"
151 input n
160 print "J"
190 print "okay. here they go"
200 s=1
210 t=1
220 if s > = n then 270
230 if t > = n then 270
240 print s; t;
250 s=s+t
260 t=t+s
265 go to 220
270 print
271 print "another game, while fibonacci is waiting (y), or no more? (n)": print
272 get c$: if c$ = "" then 272
273 if c$ = "y" then 150
274 if c$ = "n" then 300
280 go to 272
300 print "mr. fibonacci is leaving now,"
310 print "and wishes to see you again sometime in the future"
312 print
313 print
315 print "here goes his car!!!!!!!!"
320 print "(brmmmm-brmmmm-putt-putt-vraow-chatter-chatter bye mr. fibonacci!)"
390 go to 450
410 print
420 print
445 nexti
450 end

(I suppose the print "J" might be some kind of clear screen, mangled by the publishing pipeline.)

The other two programs are from an article published at age 8:

I heard Terence mention to Tom that he was especially pleased with a computer program he had written on perfect numbers. Having always had an interest in number theory I asked Terence if I could see the program. Terence told me that he had submitted it, for possible publication, to Trigon, a student mathematics journal published in South Australia. Subsequently, the program together with some comments by Terence, was accepted for publication.

First, prime numbers, which you can run here

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

Finally, using the same tactic, the seach for perfect numbers, which you can run here.

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
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

We’re told Terence did his programming on a Commodore computer, but we don’t know what kind. A brief appearance in a television program shows him using a BBC Micro - he’s in Adelaide, Australia.

1 Like

Likely. PetSCII’s character for that (chr$(147)) appears as a reverse-video heart.

1 Like

The hypothesis of the “J” representing a heart character makes even more sense with the type face used (as compared to Commodore’s screen character glyphs):

print-J

Regarding the origin of the program, the all lower-case source code may suggest a PET with BASIC 4.0, defaulting to the lower-case/uper-case character set. (Programs for Commodore machines which defaulted to the upper-case/graphics character set were usually listed in upper-case.)

Emulator hint: When dragging&dropping source files or pasting them, you may use any the usual labels or abbreviations for special characters inside curly brackets, like PRINT "{CLS}" or PRINT "{4 DOWN}" or PRINT "{8 SPACES}TEST", etc.
See here for details: https://masswerk.at/pet/#help=petHelpTopicEscapes

1 Like