# Enigmatic Code

Programming Enigma Puzzles

## Enigma 829: How do you manage without one?

My word processor has developed a fault. There’s one particular digit which it will not type: if you press the appropriate key absolutely nothing happens.

I can, for example, type the cube of 4 correctly, but not the square. Whereas for the larger number 78 (whose number of digits is less than the one-figure number I cannot type) I can correctly type both its cube and square.

Which digit do I keep missing out?

#### News

Between the Enigmatic Code and S2T2 sites there are now 3000 puzzles available.

On Enigmatic Code there are now 1658 Enigma puzzles available (which leaves 134 remaining to post). All 90 puzzles from the Puzzle series are available, as well as 215 from the Tantalizer series (and about 283 that are not yet posted). And we have all puzzles from the current Puzzle # series (which is ongoing, and most recently reached Puzzle #213).

And on the S2T2 site there are currently 840 Teaser puzzles available (these are also ongoing, and has just reached Teaser 3156, so there are quite a lot of those remaining. But I have been working through the published books of puzzles and newspaper archives that are available).

Along with a few additional puzzles that brings the total to the magical 3000.

If you have been playing along with me and have solved all the puzzles posted so far, then well done! It has been quite a journey.

As long as I have the time I will keep posting puzzles to the sites. Thanks to those who have contributed to the site, either by sourcing puzzles or sharing their solutions.

Happy Puzzling,

— Jim

[enigma829]

### 2 responses to “Enigma 829: How do you manage without one?”

1. Jim Randell 20 March 2023 at 9:17 am

We first note that the puzzle contains the digits 4, 7, 8, so these cannot be the misbehaving digit.

The larger number (containing digits 7 and 8) has at least 2 digits, so the misbehaving digit must be 3 or more.

So the possibilities for the misbehaving digit are narrowed down to: 3, 5, 6, 9.

This Python program runs in 59ms. (Internal runtime is 679us).

Run: [ @replit ]

```from enigma import (irange, nconcat, subsets, update, sq, cb, nsplit, printf)

# does number n contain digit d?
contains = lambda n, d: d in nsplit(n)

# construct numbers of length a .. b by inserting extra digits d into ds
# return (k, n), where n is a k-length number
def number(a, b, d, ds, i=0):
for k in irange(a, b):
# construct the k-length number
rs = [d] * k
# and replace the existing digits
for js in subsets(irange(k), size=len(ds)):
yield (k, nconcat(update(rs, js, ds)))

# consider the misbehaving digit
for d in [3, 5, 6, 9]:
# consider the number of digits in the larger number (containing 7 and 8)
for (k, n) in number(2, d - 1, d, [7, 8]):
# the square and cube cannot contain d
if contains(sq(n), d) or contains(cb(n), d): continue
# there is a smaller number that contains the digit 4
for (k_, n_) in number(1, k, d, ):
if not (n_ < n): continue
# whose square cannot be typed correctly, but whose cube can
if not (contains(sq(n_), d) and not contains(cb(n_), d)): continue
# output solution
printf("d={d} -> {n_}, {n}")
```

Solution: The misbehaving digit is 6.

The first number (“4”) is actually 664:

The cube of 664 is 292754944, which does not contain the digit 6, so can be typed correctly.

And the square of 664 is 440896, which does contain the digit 6, so cannot be typed correctly.

The second (larger) number (“78”) is actually 768:

The cube of 768 is 452984832, which does not contain the digit 6, so can be typed correctly.

The square of 768 is 589824, which also does not contain the digit 6, so can also be typed correctly.

2. Jim Olson 20 March 2023 at 9:49 pm

Thanks for all the great times spent on working out solutions to the published puzzles.

This site uses Akismet to reduce spam. Learn how your comment data is processed.