# An Integer Temperature Puzzle

1. Apr 15, 2007

### K Sengupta

The other day, Mack was preparing a table consisting of integer Fahrenheit temperatures (F) which yields integer Celsius (C) equivalent upon conversion.

He noted that F= 527 gave the corresponding C value as 275 and realized that, he could have simply moved the first digit in F to the end to obtain C.

Mack has since been trying in vain to find the next larger F value with this property.

Do the next larger F exist, and if so, what is that value?

2. Apr 16, 2007

### Edgardo

In the following I have assumed that only 3-digit temperatures
are allowed. The outline of the proof looks as follows:
1) Show that Celsius is divisible by 5
2) Show that (Fahrenheit-32) is divisible by 9
3) Show that the first digit of Fahrenheit is 5.
4) Show that the sum of the last two digits of Fahrenheit is divisible by 9
5) Finally show that the only possible Fahrenheit temperature is 527.

----------------------------------------------------

The formula is Celsius = (Fahrenheit-32)*5/9
or in short: C = (F-32)*5/9

What conditions are given?

CONDITION 1)
Celsius is a 3-digit natural number, thus
C = (c1 c2 c3) where c1,c2,c3 are the digits of the temperature C in Celsius

CONDITION 2)
Fahrenheit is also a 3-digit natural number, thus
F = (f1 f2 f3) where f1,f2,f3 are the digits of the temperature F in Fahrenheit

CONDITION 3)
The "swap-condition" requires
(f2 f3 f1) = (c1 c2 c3)

CONDITION 4)
f1 not equal to 0 => c3 not equal to 0 (follows from condition 3)
c1 not equal to 0 => f2 not equal to 0 (follows from condition 3)

CONDITION 5)
If F> 527 => F > C
(One can show, that F > C if F > -40)

With these conditions set up, we start solving the problem.

----------------

[size=+1]Theorem 1:[/size] (F-32) is divisible by 9.
Proof:
F is a natural number (and F>527)
=> (F-32)5 is a natural number

We require C is a natural number.
=> (F-32)5/9 is a natural number (right hand side of equation at the top).
This is only possible if (F-32) is divisible by 9.
[]

We can write
(F-32) = (f1 f2-3 f3-2)
where f1, f2-3 and f3-2 are the first, second and last
digits of (F-32).

[size=+1]Conclusion 1:[/size] f1 + f2-3 + f3-2 is divisible by 9
Proof:
This follows from Theorem 1.
[]
---------------------------

[size=+1]Theorem 2:[/size] C is divisible by 5.
Proof:
Rearranging the formula at the top yields:

9/5 Celsius = Fahrenheit - 32
or in short:
9/5 C = (F-32)
Since the right hand side is a natural number, the left hand side
must also be a natural number. This is only possible if C is divisible by 5.
[]

[size=+1]Conclusion 2:[/size] C is of the form (c1 c2 5)
Proof:
From Theorem 2 it follows that
the last digit c3 of C must either be a 0 or a 5,
so the general form for C will be:

(i) (c1 c2 0)
(ii) (c1 c2 5)

Since c3 does not equal zero (see CONDITION 4), C must
be of the form (ii), thus
C = (c1 c2 5).
[]

[size=+1]Theorem 3:[/size] f2 + f3 must be divisible by 9.
Proof:
From conclusion 1 we know that
f1 + f2-3 + f3-2 is divisible by 9.

We can rewrite this in terms of c1,c2,c3 by CONDITION 3:
f1=c3
f2=c1
f3=c2
Thus,
c3 + c1-3 + c2-2 is divisible by 9
We can further replace c3 by 5 (Conclusion 2):
5 + c1-3 + c2-2 is divisible by 9

=> c1 + c2 is divisible by 9.
=> f2 + f3 is divisible by 9.
[]

[size=+1]Conclusion 3:[/size] There is only one 3-digit number, namely 527 that fulfills the
conditions mentioned in the problem.

Proof:
From conclusion 2 it follows:
F has the form (5 f2 f3)

From Theorem 3 it follows
that possible values for F are:
(5 0 9)
(5 1 8)
(5 2 7)
(5 3 6)
(5 4 5)
(5 5 4)
(5 6 3)
(5 7 2)
(5 8 1)
(5 9 0)
(5 9 9)

Since F > C (see CONDITION 5), it follows:
(f1 f2 f3) > (c1 c2 c3)
In particular,
f1 > c1 or f1 = c1
Since c1=f2 we can write:
f1 > f2 or f1 = f2.

This reduces the possible values for F to:
(5 0 9)
(5 1 8)
(5 2 7)
(5 3 6)
(5 4 5)
(5 5 4)

If F is even, then (F-32) is even
=> (F-32)5 has 0 as last digit (an even number times 5 has 0 as last digit)
=> c3=0
but we already stated in Conclusion 2 that
c3 = 5
Thus, F cannot be even. This further reduces
the possible values for F to:
(5 0 9)
(5 2 7)
(5 4 5)
From condition 4 (c2 does not equal 0) we can reduce
the possible values for F to:

(5 2 7)
(5 4 5)

Plugging in these two values into the equation at the top, yields:

(i) F = 527
=> c = (527-32)*5/9 = 495*5/9 = 55*5 = 275
This fulfills the swap condition.

(ii) F = 545
=> C = (545-32)*5/9 = 513*5/9 = 57*5 = 285
This does not fulfill the swap condition.

We finally showed that the only number is F=527 fulfilling the problem's
condition.

3. Apr 17, 2007

### davee123

It looks like this solution might exist, and the fahrenheit temperature would start with "5294117647058", but I can't figure out how to precisely narrow down this number if it exists. There's a specific range for every order of magnitude beyond 100 where the fahrenheit number gets *close* to the celcius number if you move the first digit to the rear:

527 F => 275 C *exact*
5279 F => 2915 C *too low*
5297 F => 2925 C *too high*
52925 F => 29385 C *too low*
52943 F => 29395 C *too high*
529403 F => 294095 C *too low*
529421 F => 294105 C *too high*
5294111 F => 2941155 C *too low*
5294129 F => 2941165 C *too high*
52941173 F => 29411745 C *too low*
52941191 F => 29411755 C *too high*
529411757 F => 294117625 C *too low*
529411775 F => 294117635 C *too high*
5294117633 F => 2941176445 C *too low*
5294117651 F => 2941176455 C *too high*
52941176465 F => 29411764685 C *too low*
52941176483 F => 29411764695 C *too high*
529411764695 F => 294117647035 C *too low*
529411764713 F => 294117647045 C *too high*
5294117647049 F => 2941176470565 C *too low*
5294117647067 F => 2941176470575 C *too high*
52941176470571 F => 29411764705855 C *too low*
52941176470589 F => 29411764705865 C *too high*
529411764705863 F => 294117647058795 C *too low*
529411764705881 F => 294117647058805 C *too high*

I wrote a script to sort-of bash away at this, but beyond this point, my program can't calculate it, because it starts getting into scientific notation which gets imprecise at the lower decimal places.

So... there's definitely a pattern, and it looks like it MIGHT get there eventually, but I can't seem to prove one way or another that it really exists.

Acha! It DOES exist! Of course, it's over 1 quintillion degrees, so from a physics perspective, "temperature" may no longer apply to any physical object heated that hot, but in theory, it exists! See below:

5294117647058823527 F = 2941176470588235275 C

For the record, here's a few more, it should be easy for Mack to derive his pattern:

5294117647058823527
52941176470588235294117647058823527
529411764705882352941176470588235294117647058823527
5294117647058823529411764705882352941176470588235294117647058823527
52941176470588235294117647058823529411764705882352941176470588235294117647058823527
529411764705882352941176470588235294117647058823529411764705882352941176470588235294117647058823527

DaveE

Last edited: Apr 17, 2007
4. Apr 18, 2007

### Edgardo

Below my new answer in white.

Ok, in my former post I restricted F to a 3-digit number.
However, I approached the problem again, but this time differently.
I found a number for F, namely:

F = 5294 1176 4705 8823 527

Plugging this into the formula C = (F-32)*5/9 yields:

C = 294 1176 4705 8823 5275

which indeed resembles F as described in the problem.

I will describe how I found the number later.
It involved examining an expression if it is divisible by 17.
I've done most of the calculations by hand, because
the big numbers (10^19) couldn't be handled by calculators
or math programs.

Last edited: Apr 18, 2007
5. Apr 18, 2007

### Edgardo

Hello davee123,

The rest of my text is in white as not to spoil the answer (please keep reading davee123).

I see that you've written a program that can handle large numbers.
I've got a formula for those numbers. Could you check with your
program if my formula reproduces your numbers?

The formula I derived:

F = 1/17 * [ 9 * 10^{16k+3} - 41 ]

http://rogercortesi.com/eqn/tempimagedir/eqn5254.png [Broken] the formula written in Latex.

for k=0,1,2,3,4......

Last edited by a moderator: May 2, 2017
6. Apr 18, 2007

### davee123

Yep! They match up perfectly! I would be curious to see how you arrived at the answer, though.

DaveE

7. Apr 24, 2007

### ssb

omg you guys are insane, just a letting you know. :-)

8. May 16, 2007

### Edgardo

Here is how I solved the problem:

STEP 1:
The connection between the temperature in Celsius and the temperature in Fahrenheit is expressed by

the formula $$C = (F-32) \cdot \frac{5}{9}$$ where C and F are integers.

$$(F-32)$$ is an integer and must be divisible by 9, otherwise the right hand side of the formula is not an integer which contradicts C being an integer.

Our formula can be manipulated to $$\frac{C}{5} = \frac{(F-32)}{9}$$.

C must be divisible by 5 because
$$\frac{(F-32)}{9}$$ is an integer. Let us manipulate the formula again: $$C=(\frac{F-32}{9})\cdot 5$$.
We can conclude that C has 0 or 5 as last digit.

Let us introduce a notation for the digits of C and F:
$$C = (c_1 c_2 ... c_{n-1} c_n)$$ and $$F = (f_1 f_2 ... f_{n-1} f_n)$$ with $$c_1 \neq 0$$ and $$f_1 \neq 0$$.

Now, the problem says: Moving the last digit of F to the end yields C,
for example $$F=527$$ and $$C=275$$. Let's call this a Swap, so in general we have
$$Swap[F]= Swap[(f_1 f_2 ... f_{n-1} f_n)] = (f_2 ... f_{n-1} f_n f_1)$$
The swap condition means $$Swap[F] = C$$, thus $$(f_2 ... f_{n-1} f_n f_1)=(c_1 c_2 ... c_{n-1} c_n)$$

We know that $$c_n = 0$$ or $$c_n = 5$$, thus $$f_1 = 0$$ or $$f_1 = 5$$. But since
$$f_1 \neq 0$$, it follows that $$f_1 = 5$$ and $$c_n=5$$.

$$C = (c_1 c_2...c_{n-1} 5)$$
$$F = (5 f_2... f_{n-1} f_n)$$

-----------------------------------------------------------

STEP 2
We know from the swap condition that
$$C = (f_2 f_3 ... f_{n-1} f_n 5)$$
Let us compare this with F:
$$F = (5 f_2... f_{n-1} f_n)$$
We notice that the digits $$(f_2 f_3 ... f_{n-1} f_n)$$ occur both in C and F. Let us make use of this:

a) $$(C-5) = (f_2 f_3 ... f_{n-1} f_n 0)$$

b) $$10F = (5 f_2 f_3 ... f_{n-1} f_n 0)$$

$$10F-5 \cdot 10^n = (f_2 f_3 ... f_{n-1} f_n 0) = (C-5)$$
$$\Rightarrow 10 F = 5 \cdot 10^n + (C-5)$$

We plug in the temperature formula for C:
$$10F = 5 \cdot 10^n + (F-32) \cdot \frac{5}{9} - 5$$

$$\Rightarrow 10F = 5 \cdot 10^n + \frac{5}{9} F - 32 \cdot \frac{5}{9} - 5$$

$$\Rightarrow \frac{85}{9}F = 5 \cdot 10^n - \frac{205}{9}$$

$$\Rightarrow 85F = 45 \cdot 10^n - 205$$

$$\Rightarrow F = \frac{45}{85} \cdot 10^n - \frac{205}{85}$$

$$\Rightarrow F = \frac{9}{17} \cdot 10^n - \frac{41}{17}$$

We finally obtain

$$\Rightarrow F = \frac{1}{17} ( 9 \cdot 10^n - 41)$$
The question is, for which values of n is F an integer. Does such a value for n even exist (besides the n for our example $$F=527$$)?
In Step 3 and 4 we want to examine for which values of n the expression $$(9 \cdot 10^n - 41)$$ is divisible by 17.

------------------------------------------------------

STEP 3
We already know that $$F=527$$ fulfills the swap condition. We obtain $$F=527$$ for $$n=3$$:
$$F = \frac{1}{17} (9 \cdot 10^3 -41) = \frac{1}{17} (9000 - 41) = \frac{1}{17}(8959) = 527$$

There is a rule for testing whether a number is divisible by 17, see
here: http://www.egge.net/~savory/maths1.htm and http://primes.utm.edu/curios/page.php/17.html

In order to illustrate the rule we test if 8959 is divisible by 17:
Step 1: Split 8959 in 895 and 9 (last digit), multiply 9 (the last digit) by 5: $$9 \cdot 5 = 40$$.
Step 2: Substract this from the ramaining digits 895: $$895-9\cdot5=850$$.
Step 3: If the last two or three remaining digits are divisible by 17 then the original number 8959 is divisible by 17, too. In this case, 850 is divisible by 17, thus 8959 is divisible by 17, too.

So, for $$n=3$$, F is an integer. What about $$n=4$$:

$$F = \frac{1}{17}(9 \cdot 10^4 -41) = \frac{1}{17}(90000-41) = \frac{1}{17}(89959)$$

Let's test if 89959 is divisible by 17:
Step 1: $$8995-9\cdot 5 = 8955$$
Step 2: $$895 -5 \cdot 5 = 870$$
Step 3: 870 is not divisible by 17, so 89959 is not divisible by 17.

Now, we could carry on with $$n=5$$:
$$F = \frac{1}{17}(9 \cdot 10^4 - 41) = \frac{1}{17} (89959)$$

Instead, before proceeding with steps 1 to 3 of the divisibility test, we observe the following:

$$9 \cdot 10^n -41$$ has the following values for $$n=3,4,5,6,...$$

$$n=3: 9000-41 = 8959$$

$$n=4: 90000-41 = 89959$$

$$n=5: 900000-41 = 899959$$

$$n=6: 9000000-41 = 8999959$$
...

The number on the right hand side has the form $$899.....959$$.
We can observe that the 9-digits increase with increasing n. We will use this
in Step 4.

(It follows Step 4 that might be difficult to understand but I'll try my best to explain it.)

---------------------------------------------------------------------

STEP 4

If we go through steps 1 to 3 of the divisibility test by 17, we can get
from $$n=4$$ to $$n=5$$ by just putting a further 9-digit to the left. This means a shortcut because we can use the results from the (n=4)-test for the (n=5)-test. You will (hopefully) see what I mean:

The number that has to be tested for divisibility by 17 has the form $$899.....959$$.
We consider only the last digits 959 and start our test for divisibility by 17:

$$n=3: 959 \rightarrow 95-9\cdot 5 = 50$$ (850 is divisible by 17)
$$n=4: (50 \rightarrow) 950 \rightarrow 95-0 \cdot 5 = 95$$ (895 is not divisible by 17)
$$n=5: (95 \rightarrow) 995 \rightarrow 99- 5 \cdot 5 = 74$$ (874 is not divisible by 17)

Before we proceed, we write down the multiples of 17 from 800 to 899. List: 816, 833, 850, 867, 884.
The reason is that we don't want to check each time whether the remaining 3-digits (850, 895, 874...) from our divisibility test are divisible by 17. Instead, we just check if the remaining 3-digits are in the list.

$$n=6: (74 \rightarrow) 974 \rightarrow 97- 4 \cdot 5 = 77$$ (877 is not in our list)
$$n=7: (77 \rightarrow) 977 \rightarrow 97- 7 \cdot 5 = 62$$ (862 is not in our list)
$$n=8: (62 \rightarrow) 962 \rightarrow 96- 2 \cdot 5 = 86$$ (886 is not in our list)
$$n=9: (86 \rightarrow) 986 \rightarrow 98- 6 \cdot 5 = 68$$ (868 is not in our list)
$$n=10: (68 \rightarrow) 968 \rightarrow 96- 8 \cdot 5 = 56$$ (856 is not in our list)
$$n=11: (56 \rightarrow) 956 \rightarrow 95- 6 \cdot 5 = 65$$ (865 is not in our list)
$$n=12: (65 \rightarrow) 965 \rightarrow 96- 5 \cdot 5 = 71$$ (871 is not in our list)
$$n=13: (71 \rightarrow) 971 \rightarrow 97- 1 \cdot 5 = 92$$ (892 is not in our list)
$$n=14: (92 \rightarrow) 992 \rightarrow 99 - 2 \cdot 5 = 89$$ (889 is not in our list)
$$n=15: (89 \rightarrow) 989 \rightarrow 98 - 9 \cdot 5 = 53$$ (853 is not in our list)
$$n=16: (53 \rightarrow) 953 \rightarrow 95 - 3 \cdot 5 = 80$$ (880 is not in our list)
$$n=17: (80 \rightarrow) 980 \rightarrow 98 - 0 \cdot 5 = 98$$ (898 is not in our list)
$$n=18: (98 \rightarrow) 998 \rightarrow 99 - 8 \cdot 5 = 59$$ (859 is not in our list)
$$n=19: (59 \rightarrow) 959 \rightarrow 95 - 9 \cdot 5 = 50$$ (850 is in our list!)

So, for $$n=3$$ and $$n=19$$, the number $$(9\cdot 10^n-41)$$ is divisible by 17. If we carry on the test
for $$n=20,21,...$$ it is clear that after 16 steps, i.e. $$n=35$$, the remaining 3-digit will be 850 again.

Thus, n has the form $$n=3+16k$$ with $$k=0,1,2,3,...$$. Our final result for F is

$$F = \frac{1}{17} (9 \cdot 10^{3+16k}-41)$$ with $$k=0,1,2,3...$$.

For $$k=1$$ we get the value F = 5294 1176 4705 8823 527 (I had to calculate this by hand because the number is too big for the calculator). The corresponding value for C is obtained by plugging F
into the formula $$C = (F-32) \frac{5}{9}$$. We get C = 294 1176 4705 8823 5275.
F = 5294 1176 4705 8823 527 and C = 294 1176 4705 8823 5275 obviously fulfill the swap condition.

Note: Before I discovered that after 16 steps the remaining 3-digit is divisible by 17, I actually thought that F=527 is the only number that fulfills the swap condition. So, I was actually hoping for a remaining 3-digit (not in our list) to occur twice. For example, if for n=8 and n=13 the remaining 3-digit was 886, it would be clear that for n=18 the 3-digit 886 occured again. From this it would have followed that no remaining 3-digit was divisible by 17, thus F=527 would have been the only number that fulfilled the swap condition.

Last edited by a moderator: Apr 22, 2017