Date: Mon, 1 Jan 2007 22:01:16 -0500 (EST) From: "Keith F. Lynch" <kfl at KeithLynch.net> To: WSFA members <WSFAlist at KeithLynch.net> Subject: [WSFA] Re: Ex-presidents of the US Reply-To: WSFA members <WSFAlist at KeithLynch.net> ronkean at juno.com wrote: > Wouldn't the period before the inauguration of the second president > qualify as well as the period before the inauguration of the first > president? Good point. And in fact I went on to say "Washington was the only president to have no ex-presidents alive during *any* part of his presidency," contradicting myself. > Your first sentence there is a true statement, but it might not > make a complete basis for the appropriate algorithm, because an > ex-president might become president again. Exactly. That happened once. > When that happens, the question arises whether that president is > considered to be both an ex-president and a sitting president at the > same time, or temporarily loses his status as living ex-president > while he is a sitting president. I would say the latter. > What programming language did you use, Plain old C. > and how long did it take you to write and debug the program? About an hour. > How could one be sure that such a program would always give the > correct answer? I made it very simple, which is also how I was able to do it so quickly. Having been raised in the days when CPU time was precious, I'm always tempted to spend hours making a program more efficient, even if it only saves milliseconds of CPU time. But instead I wrote this in the simplest possible way. For each and every day starting when George Washington was born and ending today, I check each and every president to see if they were born that day, inaugurated that day, or died that day. The raw output was as follows: + 1 03/04/1797 - 0 12/14/1799 + 1 03/04/1801 + 2 03/04/1809 + 3 03/04/1817 + 4 03/04/1825 - 3 07/04/1826 - 2 07/04/1826 + 3 03/04/1829 - 2 07/04/1831 - 1 06/28/1836 + 2 03/04/1837 + 3 03/04/1841 + 4 03/04/1845 - 3 06/08/1845 - 2 02/23/1848 + 3 03/05/1849 - 2 06/15/1849 - 1 07/09/1850 + 2 07/10/1850 + 3 03/04/1853 + 4 03/04/1857 + 5 03/04/1861 - 4 01/18/1862 - 3 07/24/1862 - 2 06/01/1868 + 3 03/04/1869 - 2 10/08/1869 - 1 03/08/1874 - 0 07/31/1875 + 1 03/03/1877 + 2 03/04/1881 + 3 03/04/1885 - 2 07/23/1885 - 1 11/18/1886 + 2 03/04/1889 - 1 01/17/1893 - 0 03/04/1893 + 1 03/04/1893 + 2 03/04/1897 - 1 03/13/1901 - 0 06/24/1908 + 1 03/04/1909 + 2 03/04/1913 - 1 01/06/1919 + 2 03/04/1921 - 1 02/23/1924 + 2 03/04/1929 - 1 03/08/1930 - 0 01/05/1933 + 1 03/04/1933 + 2 01/20/1953 + 3 01/20/1961 - 2 10/20/1964 + 3 01/20/1969 - 2 03/28/1969 - 1 12/26/1972 - 0 01/22/1973 + 1 08/04/1974 + 2 01/20/1977 + 3 01/20/1981 + 4 01/20/1989 + 5 01/20/1993 - 4 04/22/1994 + 5 01/20/2001 - 4 06/05/2004 - 3 12/26/2006 19th century 2.189788 20th century 1.885969 21st century 4.556772 If you look closely, there may be some glitches in there, depending on whether there were any days since 1789 when nobody was president. But they don't matter to the final results. To test my code that converts dates into days since George Washington was born and back, I simply tested it on each and every day from the day he was born to the year 2200, making sure no dates shifted, were duplicated, or were skipped. I also spot checked that that number of days is divisible by seven for dates that are Fridays. The most likely source of error is the table of birthdays, etc. I got it from one reputable source, and checked it against another, but not against a third. I'm also assuming that the first four presidents all had their birthdays converted to the Gregorian calendar. (I know Washington did.) If I'm wrong, some of the first four dead-as-long- as-alive dates could be off by eleven days. I'm ignoring fractional days. Those could make many of the dead-as-long-as-alive dates off by one day in either direction. As you mentioned, I'm ignoring time alive in utero. I don't have conception dates for all the presidents. Or for any of them.