wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> easy >> Centigrade to Fahreheit
(Message started by: THUDandBLUNDER on Oct 5th, 2003, 3:18am)

Title: Centigrade to Fahreheit
Post by THUDandBLUNDER on Oct 5th, 2003, 3:18am
Converting 275oC to Fahrenheit we get 527oF. In fact, we could have just moved the 5 to the front.

What is the next largest example where moving the last digit to the front gives the right answer?

Title: Re: Centigrade to Fahreheit
Post by Sir Col on Oct 5th, 2003, 4:21am
Once again, a lovely puzzle, T&B.

::[hide]
It seems that 275oC is the only example!

Let us consider 3-digit examples, C=100x+10y+z.

F=9C/5+32=180x+18y+9z/5+32, and we are trying to find this equal to 100z+10x+y.

Equating and tidying up, 85(10x+y)+160=491z.

So z must be divisible by 5; but this was obvious from the fact that F=9C/5+32, and C must divide by 5 to obtain integer F. However, we also know that z[ne]0, as this would produce a 2-digit number, by placing the zero at the front. Hence z=5.

Therefore, 85(10x+y)=2295, giving 17(10x+y)=459[equiv]0 mod 9. Hence, 10x+y[equiv]0 mod 9, so, x+y[equiv]0 mod 9.

That is, we're looking for, C, a 3-digit number of the form xy5, where x+y[equiv]0 mod 9. A quick test of possibilities fails in each case: 365, 455, 545. However, C[ge]545 produces F with 4-digits.

My logical is a little faulty from here, but I will be bold enough to claim that no more solutions exist. It is faulty, because there remains a possibility that, F, having more digits than C, may end in zero, in which case it would produce a number with the same number of digits as C.

Can anyone finish off my proof?
[/hide]::

Title: Re: Centigrade to Fahreheit
Post by THUDandBLUNDER on Oct 5th, 2003, 4:42am
For the 3-digit case, I get [hide]F = 100z + [(C-z)/10] and we know that z must equal 5.[/hide]


Quote:
Can anyone finish off my proof?

No.  :P


Title: Re: Centigrade to Fahreheit
Post by towr on Oct 5th, 2003, 9:22am
I've tried solving it a little differently
[hide]
using (10*a+b )*9/5+32= 10^i *b + a (where i is the number of digits in a)
Since it's obvious b=5, we get
18*a+9+32= 10^i *5 + a
so 17*a = 5 * 10^i - 41
which is easy enough to try and find for different i's.
I haven't found any other number in the range of C-integers (2^32)

But I don't yet see any fundamental reason why 5 * 10^i - 41 wouldn't be divisable by 17 for i's over 2.[/hide]

Title: Re: Centigrade to Fahreheit
Post by Sir Col on Oct 5th, 2003, 12:59pm
Towr, what a clever approach...
::[hide]
The problem reduces to finding 5x10i–41[equiv]0 mod 17, or 5x10i[equiv]7 mod 17.

Using the good old Windows calculator again, I found 5x1018[equiv]7 mod 17. Therefore a=(5x1018–41)/17=294117647058823527.

Hence the next example is, 29411764705882352750C.
[/hide]::

Title: Re: Centigrade to Fahreheit
Post by towr on Oct 5th, 2003, 1:57pm
hmm.. I should have been able to find that.. If I had programmed more cleverly..

Title: Re: Centigrade to Fahreheit
Post by THUDandBLUNDER on Oct 6th, 2003, 3:31am

Quote:
hmm.. I should have been able to find that.. If I had programmed more cleverly..

: [hide]All the solutions are given by C = 5*(1016m+3 - 65)/17 where m = 0,1,2...[/hide]  



Title: Re: Centigrade to Fahreheit
Post by Sir Col on Oct 6th, 2003, 3:40am
Very clever, T&B, but can you prove that your formula works for all values of m and provides the complete solution set?  ::)

Title: Re: Centigrade to Fahreheit
Post by THUDandBLUNDER on Oct 6th, 2003, 6:36am

Quote:
Very clever, T&B, but can you prove that your formula works for all values of m and provides the complete solution set?

Yes, I can.  ::)

Let C = xn-1*10n-1 + ... + x1*10 + x0
Then F = x0*10n-1 + (C - x0)/10.

F = (9C/5) + 32 => x0 = 5

Hence (9C/5) + 32 = 5*10n-1 + [(C - 5)/10]

This gives C = 5*(10n - 65)/17

As 10 is a primitive root modulo 17, it follows that C is an integer iff n is of the form 16m+3.  


Title: Re: Centigrade to Fahreheit
Post by Sir Col on Oct 6th, 2003, 10:18am
Nice, but could you please explain the last past?

Quote:
As 10 is a primitive root modulo 17, it follows that C is an integer iff n is of the form 16m+3.


Title: Re: Centigrade to Fahreheit
Post by THUDandBLUNDER on Oct 6th, 2003, 11:28am

Quote:
Nice, but could you please explain the last past?

You asked for a proof. Fair enough, I gave one. But now you are expecting me to understand it??  ::)

OK, here is my primitive attempt:

We have C = 5*(10n - 65)/17
Hence we need 10n = 65 (mod 17)
                          = 14 (mod 17)

By Fermat's Little Theorem,
1016 = 1 (mod 17)
1016m = 1 (mod 17)
1016m+3 = 1000 (mod 17) = 14 (mod 17)

Because 10 is a primitive root mod 17, 1016m+i will run through all possibilities mod 17
Here, i = 3 gives us our 14 (mod 17)



Title: Re: Centigrade to Fahreheit
Post by Sir Col on Oct 6th, 2003, 11:59am

on 10/06/03 at 11:28:18, THUDandBLUNDER wrote:
OK, here is my primitive attempt

And explained so well, too. Thanks, T&B!



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board