## Introduction

gold Here is an eTCL script on searching for Babylonian triplets or triples. I have modified a slot calculator in eTCL to handle the search procedure for generating triplets. For now, the calculator works with a generating integer. Tap in N, eg. 1,2,3,...N and the sequence of a Babylonian triplet should be returned.

A clay tablet was discovered in Babylon giving examples of triplet numbers which were the sides of a triangle. eg. 3:4:5, While these clay findings predate Pythagoras, this page will use the accepted modern terminology and punctuation, where possible. Triplets include 3:4:5 and 8:15:17. One of the larger written triplets on the clay tablet was 3367:3456:4825. One paper indicated the order of the Babylonian terms was x?/c**2,a,c,d where c would be the hypotenuse, a the shortest side of a right triangle, and d is the line number (1-15). Given that a**2+b**2=c**2 >> b**2=c**2-a**2 >> b**2= (1-a**2)/c**2 for the right triangle, the first term may represent a solution step for b**2, either in the form of b**2/c**2 or (1-a**2)/c**2.

The calculator and buttons presented here are largely based on the Slot Calculator Demo. See https://wiki.tcl-lang.org/22245 The triplet algorithm was posted by Robert Simms, 11 June 1997, http://www.math.clemson.edu/~rsimms . The console script for triplets at the bottom of page shows what TCL can do in a few simple lines. The best thesis on the triplets was by E.C. Zeeman, referenced below. Another source of triplet info was Dr. Math of Mathforum, listed in refs.

In terms of pseudocode, should find the nearest even numbered power of 2 under N. Add 2**N + 1? for side. then find an odd power of three to add portion for side 3. Since powers of 2 and 3 can hog computer time, will limit searches to small N. (with limit statements in calculator.)

### pseudocode on the triplet algorithm

```    pseudocode: count integers to N
pseudocode: count powers of 2 along the way
and estimate if  conditions prevail.
pseudocode:  find the highest and nearest
even numbered power of 2 under N.
pseudocode:  then find an odd power of three
Pseudocode:  add quantity to raise side.
Pseudocode: take sqrt(c**2-a**2) to find remaining side
pseudocode:  to zero
pseudocode:  & zeros display```

### Reconstructed listing of the triplets on Tablet Plimpton 322

```       Triplet a,b,c & angle in degrees
from tablet Plimpton 232
prob. from Senkereh
ref.E.C.  Zeeman
119,120,169, 44.8
3367,3456,4825,44.3
4601,4800,6649,43.8
***12709,13500,18548,43.3***
65,72,97,42.1
319,360,481,41.5
2291,2700,3541,40.3
799,960,1249,39.8
481,600,769,38.7
4961,6480,8161,37.4
3,4,5,37.4
1679,2400,2929,35.0
161,240,289,33.9
1771,2700,3229,33.3
28,45,53,31.9
175,288,337,31.3 ```

Best guess is that these triplets were used in astronomy and geography. From Zeeman's paper, the triplets imply tangent ratios for angles descending from 44.8 to 31.8 degrees, in modern terms. From the example of the 3:4:5 triangle, the angle would be arctan (3/4) or 37.4 degrees. A few of the triplets seem to suggest latitudes of ancient cities, though not all.

### Conjectures on possible uses of triplets.

quantity North East
ancient citytriplet degreeslatitudeunitslongitudeunitswebsite
babylon 32.536389degrees44.420833degreeshttp://en.wikipedia.org/wiki/Sumer
eridu31.330.815839degrees 45.996069degreeshttp://en.wikipedia.org/wiki/Sumer
Hattusa40.340.019722degrees 34.615278degreeshttp://en.wikipedia.org/wiki/Sumer
lagash 31.41139degrees 46.40722degreeshttp://en.wikipedia.org/wiki/Sumer
larsa 31.331.28583 degrees 45.85361 degreeshttp://en.wikipedia.org/wiki/Sumer
nippur 32.12694degrees 45.23083 degreeshttp://en.wikipedia.org/wiki/Sumer
susa 31.932.18922 degrees 48.257785 degreeshttp://en.wikipedia.org/wiki/Sumer
ur 30.9625 degrees46.10306degreeshttp://en.wikipedia.org/wiki/Sumer
uruk 31.32222degrees 45.63611degreeshttp://en.wikipedia.org/wiki/Sumer
umma 31.633degrees 45.867degreeshttp://en.wikipedia.org/wiki/Sumer
buildingtriplet degreesslopeunits website
N. Stone Pyramid,Eygpt 43.343.6 degrees http://www.kch42.dial.pipex.com/sekes0.htm
bent pyramid(2),Eygpt43.343.35 degrees http://www.kch42.dial.pipex.com/sekes0.htm
Temple of the Sun,Teotihuacán 31.932.494degrees http://en.wikipedia.org/wiki/Pyramid_of_the_Sun

### pseudocode on Babylonian triplets

gold 10/25/2020. The role of Babylonian triplets on Plimpton 322 may be a limited set of Babylonian triplets that satisfy the reciprocal pair relationship under the constraints of the standard Babylonian reciprocal table. A possible constraint was most numbers of triangle sides under sixty. The reciprocal pair relationship as < (X+1/X)**2 - (X+1/X)**2 = 4 > was first identified with geometry and graphical methods to a normalized right triangle. Then the Babylonian mathematicians developed the reciprocal pair relationship with arithmetic methods on the Plimpton 322 tablet. According to Glaisher, the geometric theorem is equivalent to the algebraic identity (a + b)/2 - (a - b)/2 = 4ab and forms Proposition 8. of the second book of Euclid. The Binomial Theorem is a corollary or similar approach. The Binomial Theorem in Euclid II, 4, is formulated as (a + b)**2 = a**2 + 2ab+ b**2, Pascal triangle coefficients <1 2 1>. See Quarter Squares [L1 ] and Triangular Numbers on TCL Wiki [L2 ]

### pseudocode on development of Babylonian triplets

```                # pseudocode on Babylonian triplets
the role of Babylonian triplet on Plimpton 322.
2m, m**2 - 1, m**2 + 1  Babylonian triplet
twin prime number.
twin prime numbers separated by 2,4,6 ...?
c**2= a**2 + b**2
c**2= a**2 + 1        normalized Babylonian triplet
a**2  = c**2 -1       normalized Babylonian triplet
some b and c are both primes on tablet.
some b and c are not both primes on tablet.
The reciprocal pair relationship is key to triplets.
The reciprocal pairs were 2 sides to a normalized right triangle
The reciprocal pair <X-1/X> often seen as initial guess
in Babylonian  square root algorithms.
(X+1/X)**2 - (X-1/X)**2 = 4  ,
divide both sides of equation by 4
(1/4)*(X+1/X)**2 - (1/4)*(X-1/X)**2 = 1
normalized triplet, < (1/4)* ((X+1/X)**2 ) , 1 ,(1/4)* ((X+1/X)**2) >
1< X-1/X < 1+sqrt(2)  approximate upper limit of ~~ 2.4 in Plimpton 322
The Babylonian regular numbers between 0 and 60 have a limited set of triplets that
satisfy 1< X-1/X < 1+sqrt(2) which appears to be the role of Plimpton 322.
The limit 1< X-1/X < 1+sqrt(2) may explain the 1<X<2 limit
on the some Late Babylonian many place reciprocal tablets.
trial upper limit expr {(180./[pi])*atan(3367./3456)} = 44.25 <line 2>
trial upper limit expr {(1./4)*((30./60+120.)**2)} =3630.0625"
trial upper limit expr {(1./4)*((30./60-120.)**2)} =3570.0625"
trial lower limit from base_60 expr {(1./4)*((2.5+(60./(2.5)))**2)} = 175  rounded
trial lower limit from base_60 expr {(1./4)*((2.5-(60./(2.5)))**2)} = 115 rounded
trial angle formula        expr {(180./[pi])*atan(115./175.)} = 33.3 degrees
33.3 degrees is near lower limit on extant Plimpton 322 <line 15>.
d=6 even number, l = divisor of d**2 with integer result, Babylonian triplet method
a= l+b
b= d+ (d**2)//(2*l)
c= d+l+(d**2)/(2*l)
# supposed to work for all even d```

### Angle coefficients for cuneiform math from clay tablets

```  Example formula from tablets: 1 kus 15 sa.gal >> [in] one cubit 15 [is the] slope.
Usually less revealing or broken off text:
15 igi.gub >>  15 [is] reciprocal coefficient .
The clay tablet(s) include redundant terms in different expressions, usually in reciprocal values.```
coeff. in sexagesimalxydegrees cotangent ratiodecimal tangent
1;1 1 45.0 1.0 1.
0;302 1 26.56 2. 0.5
0;203 1 18.43 3. 0.333
0;154 1 14.04 4. 0.25
0;125 1 11.309 5. 0.2
0;106 1 9.462 6. 0.1666
0;097 1 8.130 7. 0.142
0;088 1 7.125 8. 0.125
0;079 1 6.340 9.0.111
0;0610 1 5.710 10. 0.1
0;091/7 1 8.130 7. 0.142
0;101/6 1 9.462 6. 0.1666
0;121/5 1 11.309 5. 0.2
0;151/4 1 14.036 4. 0.25
0;201/3 1 18.435 3. 0.333
0;301/2 1 26.565 2. 0.5
0;402/3 1 33.690 1.5 0.666

Another issue was the Babylonian tables of reciprocal or inverse numbers. This paragraph relies heavily on Melville's paper referenced below. In the Babylonian 60 base system, pairs of numbers like 2:30 have a product of 60 in base 10 and a product of 1 in base 60. Some inverse pairs are easy to remember and some are not. Some easy inverse pairs are 2:30,3:30,4:15,5:20;6:10,10:6. The Babylonians seem to have used these inverse tables for multiplication like the logarithm tables were used before the computer.

If one looks at the easy pairs found, there is an algorithm that would find some more inverse pairs. For example, a double operation on 2:30 of doubling the first number and having the second would produce would produce 4:15. Lets express the operation in pseudocode as

### pseudocode on finding more inverse pairs of reciprocals

```     pseudocode: 2*\$first:\$second*1/2.
pseudocode: set first 4 ;
set second 15;
set salty 3
set i 0
while {\$i <= \$salty} {
set first  [>2.*\$first];
set second [>\$second*(1./2.)]
if { [expr {1.*\$i} ] >= \$salty} { break  }
incr i 1;};#end```

For the pair 4:15, the operation would produce 4:15 > alg. > 8:7+1/2 (base 10). In base 60, the Babylonian would write this new pair in fraction of base 60 as 8:7+30/60. However the Babylonian would not use punctuation, but would use blanks and implied fractions, something like 8 blank 7 blank 30 . In the first column of the clay tablet, there are numbers separated by blanks ( and broken off in some spots).

Of particular note is the Babylonian triplet 12709:13500:18548 Maybe, numerical coincidence, but the diameter of the earth at the poles is 12,756.1 km. Diameter of the earth at the equator is 12713.5 km. On occasion, the Sumerians used length units that seem equivalent to the meter and 10 kilometers. The step unit or sepu was equal to one meter. The Sumerians used unit of distance called a beru which was about 10.8 km, so some of the Sumerian measurement units were multiples of the kilometer. Earth's circumference between N&S poles is (40,008 km), as a km is defined... Makes one think about what the Babylonians were measuring?

After looking at the Babylonian clay map, it was not too obvious how the circle overlapped the acute heptagon. There was one construction where the width of the do-nut seems to equal the diameter of the original circle. Anyway a "four leaf clover oriented + " was tried and seemed to work.

Trying to find some earlier estimates of earth's circumference from other cultures. Most of the early constants were given underived without sources. Scanty sources and circular reasoning , no good text reference, speculates that the Sumerians might have used 3600 beru as circumference, with the earth circumference as 3600*10.8 km. Given ~, the earth radius would be 573 beru 9_33,base 60) and diameter would be 1146 beru (19_6,base 60). Still trying to find out if "miles" on clay tablet BM 92687 are beru or else.

On Sumerian clay tablet, there are 655200 "beru ina sama" summed up, akkadian for "beru in sky." This factors to 364*60*30. There are 86400 seconds in a day. There are 655200 beru in sky over 360 conventional degrees or 1820 per degree. The apparent disk of sun or moon was supposed to be 1000 beru (~to 0.5 degree). In conventional astronomy, a degree contains 60*60 or 3600 arcseconds. So a beru in sky may something like a double second (meaning double arcsecond). In modern constants, a double arcsecond would be equivalent to 1800/111.3km or 16.17 double arcseconds per km ( from one latitude degree equals 111.3 km). A sky triangle of one degree and an opposite side of 1800 would have a side of 1800/tan(1) or 103137.638. A second and almost equal side would be 1800/sin(1) or 103121.93. considerations for circle, 360*60*60=1296000 364*60*60=1310400, say 1310400/2=655200.

Arithmetic Classic of the Gnomon and the Circular Paths of Heaven reported triplet as follows.

 60000 li 24948 km 15502.2 miles 80000 li 33264 km reputed altitude of sun 100000 li 41580 km reputed distance from measuring stick to sun

The Chinese li unit of distance was 0.4158 km (0.25837 miles). 2* babylonian 12709 =25418 Chen Zi of first century reported indirect numbers leading to earth diameter of 911489 li or 378997km. Still trying for original text, but it seems his li in the text has a factor of ten involved. Can only suggest Chen Zi's number for the earth circumference was 37900. km and implied constant was 105.27 km per degree, in modern terms. Eratosthenes third century BCE 46250 km Ptolemy c140CE 28800 km The giant of Chinese legend Pan Gu (or panku, ancient basin) held the earth and sky apart at 90000 li (45000 km). The Egyptians held that the N/S length of Egypt was 1/50 of the globe circumference. The Romans use 75 roman miles as eq to one degree of latitude. The Mogul era "Ain" states the earth's circumference was 8000 farsakh(1600CE). In some texts of Aryabhatiya, the diameter of the earth is mentioned as 3300 yojanams. Brahmagupta ( 7th c) wrote that the circumference of the earth was 36,000 km, in modern units.

The report button calls the eTCL console and adds some functions for inscribed circle. For testing, the triplet 3:4:5 has an inscribed circle of radius one. The radius one is usefull for checking common sphere and volume formulas since the number pi or multiples show obviously in the answer. Most of my functions repeat the input to be sure data being transferred correctly to procedures. Its always advisable to check at the low and high end of the expected inputs. The sphere of radius one is the low end. The big kahuna on the clay tablet was 12709:13500:18548 **console session** & The cir function take the three sides of a Babylonian triplet and returns various parameters of the triplet and inscribed circle. The form is cir aa bb cc.

### Triplets & Inscribed Circles

```   eg. cir 3 4 5
1% cir 3 4 5
3 side 1
4 side 2
5  side 3
2.0 if available, diameter of circle
6.283185307179586  if a., circumference of circle
3.141592653589793  if a., area of circle
4.1887902047863905  if a., volume of sphere
12.566370614359172  if a., surface area of sphere
3% cir 12709 13500 18548
12709 side 1
13500 side 2
18548  side 3
7666.798529486436 if available, diameter of circle
24085.957936787614  if a., circumference of circle
46165546.72275886  if a., area of circle
235961297151.32327  if a., volume of sphere
707883891453.97  if a., surface area of sphere  ```

### Screenshots Section

#### figure 1. #### figure 2. #### figure 3.

tangent angles in degrees from triplets #### figure 4. #### figure 5.

tangent angle differences in degrees from triplets #### figure 6.

alternate star #### figure 7.

possible construct for Babylonian world map ### References:

#### Pretty Print VERSION

```
# pretty print from autoindent & ased editor
# searching for Babylonian triplets
# code from TCL WIKI  Slot_Calculator_Demo
# 6Aug2010, [gold]
package require Tk
proc positionWindow w {
wm geometry \$w +300+300
}
set font  {Helvetica 18}
set colorgrd seashell4
set colorback bisque
set colorwarning tomato1
frame .frame -relief flat -bg aquamarine4
pack .frame -side top -fill y -anchor center

set names {{} {guess N:} {not used:} {not used:} {side1:} {side2:} {side3:} possible:}
foreach i {1 2 3 4 5 6 } {
label .frame.label\$i -text [lindex \$names \$i] -anchor e
entry .frame.entry\$i -width 35 -textvariable side\$i
}
set msg "Calculator for Searching Babylonian Triplets.
from TCL WIKI"

}
proc pi {} {expr acos(-1)}
# 5 = 22 + 12, 13 = 32 + 22,  5 : 12 : 13,
proc tripletxxx { xx1 yy1 xx3 yy3 xx2   } {
global side4 side5 side6
set max 1
set salty  [expr {\$xx1 + 5.}]
set i 2
while {\$i <= \$salty} {
set max \$i
if { [expr {2.** \$i} ] <= \$xx1} { set power2   [expr {2**\$i}]   }
if { [expr {3.** \$i} ] <= \$xx1} { set pow2   \$i }
if { [expr {2.** \$i} ] >= \$xx1} { break  }
incr i 2
}

set max 1
set j 0
while {\$j <= \$salty} {
set max \$i
if { [expr {3.** \$j} ] <= \$xx1} { set power3   [expr {3**\$j}]   }
if { [expr {3.** \$j} ] <= \$xx1} { set powerx   [expr {2**\$j}]   }
if { [expr {3.** \$j} ] <= \$xx1} { set pow3   \$j }
if { [expr {3.** \$j} ] >= \$xx1} { break   }
incr j 1
}

set side4 [expr {\$power2+1.}]
set side5 [expr {\$power3+\$powerx*1.}]
set sidex [expr {sqrt(\$side5**2.-\$side4**2.)}]
set side5 \$sidex
set side6 [expr {\$power3+\$powerx*1.}]
return \$power2 ;}

proc triplet { xx1   } {
global side4 side5 side6

set nn [ expr { int(\$xx1) } ]
set tt [ expr {(int ((3.+sqrt(8.*\$nn-7.))/2.))*1. }]
set ss [ expr { \$nn-(\$tt**2-3.*\$tt+2.)/2    } ]
set side5  [ expr {2.*\$ss*\$tt   } ]
set side4  [ expr {\$tt**2-\$ss**2   } ]
set side6  [ expr {\$tt**2+\$ss**2  } ]

}

proc calculate {     } {
global side1 side2 side3 side4 side5 side6
set answer2  [ triplet  \$side1   ]

set pi5 [pi]
#\$x insert 1.0 " % error \$error5 "
#\$t insert 1.0 " % error  \$error5 "

}
proc fillup {aa bb cc dd ee ff } {

.frame.entry1 insert 0 "\$aa"
.frame.entry2 insert 0 "\$bb"
.frame.entry3 insert 0 "\$cc"
.frame.entry4 insert 0 "\$dd"
.frame.entry5 insert 0 "\$ee"
.frame.entry6 insert 0 "\$ff "

}

proc clearx {} {
foreach i {1 2 3 4 5 6 } {
.frame.entry\$i delete 0 end
}
}

proc pi {} {expr acos(-1)}
proc inrad {a b c} {return  [expr {(sqrt((\$a+\$b+\$c)*(\$a+\$b-\$c)*(\$a-\$b+\$c)*(\$b+\$c-\$a)))/(2.*(\$a+\$b+\$c)) } ] }
proc pol { xx1 yy1 xx3 yy3 xx2   } {
return [expr {  (((\$xx2-\$xx1)*(\$yy3-\$yy1))/(\$xx3-\$xx1))+ \$yy1 } ] ;}
proc cir { aa bb cc } {
set cirdiameter [ expr { 2.* \$radius }]
set circlearea [ expr { [pi]*(\$radius**2) }]
set circlecircum [ expr {2.*[pi]*\$radius }]
set spherevol [ expr { (4./3.)*[pi]*(\$radius**3) }]
set spheresurface [ expr { 4.*[pi]*(\$radius**3) }]
puts "\$aa side 1 "
puts "\$bb side 2 "
puts "\$cc  side 3 "
puts "\$cirdiameter if available, diameter of circle"
puts "\$circlecircum  if a., circumference of circle"
puts "\$circlearea  if a., area of circle"
puts "\$spherevol  if a., volume of sphere"
puts "\$spheresurface  if a., surface area of sphere"
}

proc reportx {} {
console show;
puts "
& The interpolation function takes
two know points on a line and
solves for an intermediate point.
The points are xx1,yy1,xx2,yy2 and xx3,?yy3?
proc pol. User should be able
to cut and paste (c&p)
pol 50. 1000. 200. 1200. 150.
and save answer (1133.3) on console.
& The inrad function take the three
sides of a Babylonian triplet
and returns the radius of the
inscribed circle.
The form is inrad aa bb cc.
& The cir function take the three
sides of a Babylonian triplet
and returns various parameters of the
triplet and inscribed circle.
The form is cir aa bb cc.
eg. cir 3 4 5
"

}

frame .buttons -bg aquamarine4

::ttk::button .calculator -text "Solve" -command { calculate   }
::ttk::button .test2 -text "Testcase1" -command { clearx;fillup 1. 4. 5. 3.  4. 5. }
::ttk::button .test3 -text "Testcase2" -command { clearx;fillup  3. 12. 13. 5.  12. 13. }
::ttk::button .test4 -text "Testcase3" -command { clearx;fillup 6. 24. 25. 7.  24. 25. }
::ttk::button .clearallx -text clear -command {clearx  }
::ttk::button .report1 -text report -command { reportx }
::ttk::button .exit -text exit -command {exit}

pack  .clearallx .about .report1 .exit .test4 .test3  .test2   -side bottom -in .buttons
grid .frame .buttons -sticky ns -pady {0 10}
. configure -background aquamarine4 -highlightcolor brown -relief raised -border 30
wm title . "Searching for Bablylonian Triplets"```

gold10/25/2020. Changes, removed carriage returns on many paragraphs. Added Angle table. Added paragraph on Babylonian reciprocal relationship.

### Changes Log Section

Please place any changes here, Thanks.

What is your purpose in binding the motion event on your main window to execute the wm title command. I.e., this line:

`  bind . <Motion> {wm title . "Searching for Bablylonian Triplets"}`

The result of that binding is that every time you move the mouse, the "wm title" subcommand is called repeatedly. To set the window title, you just need to call "wm title . title" once, not on every event update upon mouse pointer motion.

gold changed to bare "wm title . title"

gold10/25/2020. Changes, removed carriage returns on many paragraphs. Added Angle table. Added paragraph on Babylonian reciprocal relationship.

Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, gold 12Sep2020

gold10/23/2020. code scrap under test.

### Hidden Draft on Validation

```       ;# prints gosh
;# \$result returns " 1 2 3 4 5 6 7 8 9"```

 Category Numerical Analysis Category Toys Category Calculator Category Mathematics Category Example Toys and Games Category Games Category Application Category GUI

 Category Development Category Concept Category Algorithm Tcl and other languages Category Language

 Category Calculator