Newsgroups: rec.puzzles From: hoey@AIC.NRL.Navy.Mil (Dan Hoey) Date: Fri, 15 Jul 1994 20:48:46 GMT Subject: A turn on the carouselsius (Re: Move one digit ...) cl...@cnj.digex.net (Chris Long) wrote: > When Waldo recently did a conversion of a positive integral Celsius > temperature c=275 to its Fahrenheit equivalent f (which turned out > to be 527), he noticed to his amazement that he could have simply > moved the last digit of c to the front to obtain f. Doing some > intense calculations he failed to discover the next largest such > example. Does one exist, and if so, what is it? This has been answered, but no one gave the (easy) proof that all such temperatures have been described. First, notice that for the Fahrenheit temperature to be an integer, the Celsius temperature must be divisible by 5, so the units digit must be 5. Suppose we are dealing with N+1-digit numbers. Then there is an N-digit number A such that the Celsius temperature is 10A+5 and the Fahrenheit temperature is 5x10^N + A. So the conversion equation 9C+160=5F gives us 17A + 41 = 5x10^N. Modulo 17, this requires 5x10^N==41==7; multiplying both sides by 7 gives 10^N==35x10^N==49==-2. Clearly this holds for N=2; Fermat's little theorem shows that this holds for N=16K+2, and since it doesn't hold for N=8+2 that is all the solutions there can be. So the Celsius temperature is 5+10x(5x10^(16K+2)-41)/17 = (5x10^(16K+3)-325)/17 and the Fahrenheit temperature is 5x10^(16K+2) + (5x10^(16K+2)-41)/17 = (9x10^(16K+3)-41)/17. ................ It's no coincidence that the solutions [5]294117647058823527[5] ................ are so reminiscent of 5/17 = 0.2941176470588235 and ................ 9/17 = 0.5294117647058823. If Waldo were to convert Celsius to Fahrenheit by moving the _first_ digit to the _end_, the situation is a little trickier, since he could not immediately deduce the identity of the digit. If the Celsius temerature is Dx10^N + A and the Fahrenheit is 10A+D, then 9(Dx10^N + A)+160 = 5(10A+D), so (9x10^N - 5)D=41A-160, so we need to find solutions of (9x10^N - 5)D==-160 (mod 41). Since 10^5==1(mod 41), we need only consider N (mod 5). We want (9x10^N - 5)D==-160==4; multiplying both sides by -10 gives -10(9x10^N - 5)D==-40==1. The following table shows the work (mod 41): N(mod 5) 0 1 2 3 4 10^N 1 10 18 16 -4 9x10^N 9 8 -2 21 5 9x10^N-5 4 3 -7 16 0 -10(9x10^N-5) 1 11 -12 4 0 D 1 15 17 -10 NaR (Not a Residue) The last line, taking a reciprocal mod 41, can be done by trial and error or by Euclid's algorithm. Noticing that only one value of D is a digit, the result is that N=5K, the Celsius temperature is (5x10^(5K+1)+155)/41 and the Fahrenheit ..... temperature is (9x10^(5K+1)+1591)/41; or [1]2195121955[1], where ..... ..... 5/41=0.12195 and 9/41=0.21951. For an easy ObPuzzle, try this with negative temperatures, where the digits cycle but the minus sign stays in place. For a harder ObPuzzle, make the minus sign cycle with the digits. About a year ago, rec.puzzles searched for cases of a Fahrendrome, whose Celsius equivalent has the same digits in reverse. I believe that for the case of positive integers, it was shown there are none. Suppose we allow decimal fractions, and require that the digits from the first nonzero digit through the last nonzero digit be reversed? I didn't find any of them, either, but I'm not sure I looked carefully enough. What if we allow negatives? Certainly -40F=-40C, but are there others? Dan Hoey Hoey@AIC.NRL.Navy.Mil