The file gears.adb is GNU Ada 95 (gnat) source code for computing the gear ratios of a multi-speed bike as ratios of large integers. The output can be sorted on the numerator of these ratios, and the rest of each line consulted to determine the correct order in which to shift the gears to go from low to high gear in the proper order, information that until I wrote and ran this was a total mystery to me for the bike I ride. The routine has no "interface" of any kind. Edit the gear tooth counts in the source code, and perhaps the numbers of gear wheels front and back as well, recompile and run. This was a one time run tool for me for a specific bike, and it is put up to the public domain for an Ada 95 code example for rank beginners like me, and for bicyclists who can grok gnat and would like similar information for the bikes they ride. The output for my particular bike, after running through Unix sort on the fifth numeric (ninth overall) column, looked like this: 1 : 39 , 1 : 28 => 4455360 :: 3198720 1 : 39 , 2 : 24 => 5197920 :: 3198720 2 : 50 , 1 : 28 => 5712000 :: 3198720 1 : 39 , 3 : 20 => 6237504 :: 3198720 2 : 50 , 2 : 24 => 6664000 :: 3198720 1 : 39 , 4 : 17 => 7338240 :: 3198720 2 : 50 , 3 : 20 => 7996800 :: 3198720 1 : 39 , 5 : 14 => 8910720 :: 3198720 2 : 50 , 4 : 17 => 9408000 :: 3198720 2 : 50 , 5 : 14 => 11424000 :: 3198720 The numeric columns in order are: 1) The gear wheel chosen by the position of the front gear shift. 2) The count of gear teeth on the chosen front gear wheel. 3) The gear wheel chosen by the position of the back gear shift. 4) The number of gear teeth on the chosen back gear wheel. 5) The numerator of the gear ratio fraction for the selected gears. 6) The denominator (constant, for good reasons) of the gear ratio fraction for the selected gears. The point of leaving the fractions not in lowest order (or simplest terms), and the denominator a large constant, is exactly that the result can be sorted by the numerator to put the lines into increasing gear ratio order. The gear ratio fraction, if all has gone well in the calculation, should reduce to the ratio of the second and fourth columns. The difference is that figuring out the correct order from the numerators unreduced is a breeze. Enjoy, and let me know if this code helps you find the cure for cancer or something else interesting. ===== random archival quality quote ===== "If I die my knowledge may die with me, & no one may ever have the same knowledge again." Letter from Alice May Williams of Aukland, New Zealand, to the Mount Wilson Observatory, November 7th, 1915. -- http://www.mjt.org/exhibits/letters/alice.htm -- Kent Paul Dolan.