### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,114)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,224 hits

Programming Enigma Puzzles

16 May 2012

Posted by on **From New Scientist #2865, 19th May 2012** [link]

I found an old eight-digit calculator. As usual, each position of the display consisted of seven light segments – with, for example, seven lighting up to display an “8” and four lighting up to display a “4”.

To see if it still worked, I typed in the approximation for π, namely 22/7, and found that I saw a number, but not the correct one. After some investigation I found that one of the 56 segments always failed to light. I then used 22/7 again to calculate approximations for 2π, 3π, 4π, 5π, 6π, 7π, 8π, 9π and 10π.

In two-thirds or more of these cases the answer looked like a number, but:

(a) how many of them were correct? and

(b) what was the original eight-digit number seen in the display?

[enigma1698]

Advertisements

%d bloggers like this:

The following Python program runs in 39ms.

It makes a number of (not unreasonable) assumptions about the specifics of the puzzle (i.e. the way 6, 7 and 9 are displayed on the 7-segment display, the way 7 × 22 Γ· 7 is displayed and also that the calculator truncates rather than rounding up in the final decimal place).

Solution:(a) 7 of the numbers were displayed correctly. (b) the original number seen in the display was 3.1429571.The officially published solution gives 6 numbers displaying correctly for part (a) of the answer, although in order to arrive at this solution the calculator would have to display “22” as “22.000000” (fixed point mode), which although not impossible seems less likely than the display of “22”. If you prefer this solution you can simply replace the

'{:.8g}'format string with'{:.8f}'when the numbers to check are generated. I did request clarification on this matter fromNew Scientistat the time the puzzle was published, but got no response.Another one best done on excel rather than searching using python or SQL code.

This spreadsheet solution is a bit cryptic but here it is anyway.

https://www.dropbox.com/s/j4do5hledklxqm3/Enigma1698.xlsx

Here is my solution — my answer is different because I make a different assumption about the displayed value of 7 * (22 / 7) :

I hadn’t spotted the case (22/7)*7. Here is a spruced up spreadsheet. https://www.dropbox.com/s/j4do5hledklxqm3/Enigma1698.xlsx

The way of displaying a “7” with 3 segments opens up another avenue to explore (shown in new spreadsheet), but one which doesn’t lead to a possible solution anyway, so the original number seen has to be 3.1429571

My old casio fx-361 displays numbers as shown in the spreadsheet, i.e. 4 segments for a “7”, 6 segments for a “6” and a “9”

I think the question could have been a little clearer. But I tried to make the most reasonable assumptions I could.

I think most calculators (even old ones) would display “22.” rather than “22.000000” (unless forced into fixed point mode). Although depending on which one of these you plump for you get a different answer to part (a) of the solution. Maybe New Scientist will permit both answers.

Final digit rounding doesn’t affect the answer, as the final digit can’t be the one with the failed segment.

I also dug out my old fx-450, and found it also uses the 4-segment “7”, and 6-segment “6” and “9”. Changing to the 4-segment “7” doesn’t affect my solution (although it removes the possibility of “7” displaying as “1” if a segment fails). However, using the 5-segment versions of “6” and “9” yields no solutions.

Interestingly it seems that old Casio LCD watches use the 3-segment “7”, whereas old Casio calculators use the 4-segment version.

I used to have an HP-11C which didn’t do suppression of trailing decimal zeros in the fractional part, so would display 22 as “22.00000000” (it had a 10 digit display), although it was an LCD display, and the question implies an LED display.

I did have a Commodore calculator, which had an LED display, and I think it was an 8 digit display, so it would be the closest to the one described in the question. But I’ve no idea where it is now.

Over the years I’ve acquired a number of pocket calculators of various makes. They all suppress trailing zeros after the decimal point.

The wording “I then used 22/7 again …” is a bit strange. Most calculators have an automatic constant, so having displayed the first quotient you press + and then = repeatedly for successive multiples.

And are people really still using 22/7 as an approximation to pi? 355/113 is so much more accurate (better than 7 digits) and easy to remember, with its pairs of odd digits.

Strange how calculators all seem to use four segments for 7, while clocks and watches (not just Casio) use three.