No book about mathematics written for young children could less resemble a textbook than “The Number Devil.” The author, Hans Magnus Enzensberger, who lives in Munich, is a writer and scholar but not a mathematician. This may explain how he manages to introduce number theory in such an entertaining way that his book became a bestseller in Germany. Translated by Michael Henry Heim and amusingly illustrated by Rotraut Susanne Berner, this is just the book to give to an intelligent child who falls asleep in mathematics classes.

Enzensberger imagines a 12-year-old boy named Robert who hates math because his teacher, Mr. Bockel--the name in German means an obstinate goat--is such a stupid and dull teacher. One night, after some unpleasant nightmares, Robert dreams about a friendly imp with shining eyes who calls himself a number devil. In this and 11 dreams that follow, the devil explains elementary number theory in such a refreshing way that Robert, instead of being bored, is instantly intrigued.

The devil’s instructions during the first dream couldn’t be simpler. Every integer, he explains, is reached by adding ones. Because this process can go on forever, there must be an infinity of integers and no such thing as a largest number. Similarly, 1/1, 1/11, 1/111, et cetera, generates an infinity of smaller and smaller fractions, never reaching a smallest fraction.

When 11 is multiplied by 11 you get 121, a palindrome like “madam” and “rotator” and the sentence “Straw? No, too stupid a fad. I put soot on warts.” Number palindromes also result from 111 x 111 (12,321), and 1,111 x 1,111 (1,234,321). Does this continue to produce palindromic products as the number of ones increases? No. Robert correctly guesses that the pattern fails beyond 10 ones. Moral: You can’t trust a generalization until it is proved.

Things are slightly more complicated in Robert’s second dream. The number devil convinces him that Roman numerals were such a clumsy notation that they held mathematics back for centuries. Robert learns the value of the decimal system, with digits ordered from right to left, the right most digit indicating a multiple of one, the preceding digit a multiple of 10, the next digit a multiple of 100, and so on, with zero serving as what mathematicians call a “place holder.”

In his third dream, Robert learns the importance of prime numbers, numbers evenly divisible only by themselves and one, and how to find them by a sieving method. He is told about a famous theorem (known as Goldbach’s conjecture), still not proved, that every even number greater than two is the sum of at least one pair of primes. (For example, 1998 is the sum of primes 1,993 and 5.)

The devil reveals a curious fraction in Robert’s fourth dream. One divided by seven produces an endless decimal fraction: 0.142857 142857 142857 . . . its repetition of 142857 has the surprising property that when it is multiplied by any digit from one through six, the quotient has the same digits in the same cyclic order. (Cyclic order means that first and last digits are joined. Thus 142857 x 4 = 571428.) Irrational fractions, which have no repeating pattern in their decimal expansion, come next in the same dream. The devil proves that the diagonal of a square with a side length of one has a length equal to the square root of two, an irrational number that begins 1.414213. . . .

The devil has his own whimsical terminology. Irrational numbers are called “unreasonable numbers.” Roots are called “rootabagas.” Primes are “prima donnas.” At the back of the book, there is a handy list of the devil’s terms translated into the terminology of modern mathematics. The author’s terminology is intended to inject an element of play. I’m not sure it has this effect and would prefer that teachers use standard English terms, or at least eventually plan to teach the standard terms.

Triangular and square numbers appear in Robert’s fifth dream. Triangular numbers (for example, 1, 3, 6, 10 or 15) are integers that can be modeled by dots in triangular arrays, like the 15 pool balls or the 10 bowling pins at the start of a game. Square numbers (for example 1, 4, 9 or 16) are modeled by dots in square arrays. The illustration shows the devil’s elegant “look-see” proof that every partial sum of the series of odd numbers is a square number.

The fascinating properties of Fibonacci numbers (1, 1, 2, 3, 5, 8, 13 . . .) are the topic of the sixth dream. Each number is the sum of its two predecessors. They are followed in the next dream by the wonders of Pascal’s famous number triangle. Dream eight concerns permutations and factorial numbers such as 6!, in which the exclamation mark tells you to multiply 1 x 2 x 3 x 4 x 5 x 6. It describes the different ways that six students can sit in a row.

Here are four of the topics covered in the last four dreams:

* The proof (first noticed by Galileo) that there are as many odd numbers as there are counting numbers (1,2,3,4,5 . . .). You simply pair them like so:

1 2 3 4 5 . . . .

1 3 5 7 9 . . . .

The number of numbers in both sets is a “transfinite” number that mathematicians know as aleph null, the smallest of an infinite set of transfinite numbers. Although there are twice as many counting numbers as there are odd numbers, the two sets can be put in one-to-one correspondence as shown. This proves that the two sets have the same transfinite number of elements. If aleph null is multiplied by any number, the product remains aleph null. The second transfinite number, aleph one, counts the number of points on a line segment.

* The beautiful properties of phi, the golden ratio 1.618 . . . . It is a famous irrational number that is the limit approached by the ratios of adjacent Fibonacci numbers. Phi turns up in all sorts of places: the growth of plants, in painting, in architecture and physics, as well as in endless geometrical figures. In the pentagram, or regular five-pointed star, each line segment is in golden ratio to the next larger line segment.

* The five Platonic solids, the only convex polyhedrons with faces that are regular polygons. The devil teaches Robert how to make them by cutting and folding paper.

* The difficult and as yet unsolved task of finding the shortest route that visits each of n cities when n is a large number. Mathematicians call it the “traveling salesman problem.” The general problem is unsolved except for very small values of n because calculating the salesman’s shortest path takes too much computer time, and no “efficient” procedure is known for such calculations.

In the final dream, the devil takes Robert to a party where he meets some eminent mathematicians of the past. They include Lord Rustle (Bertrand Russell) and Happy Little (Felix Klein). Little shows Robert a strange glass bottle he has invented. Its surface is closed like the surface of a sphere, yet it has no inside or outside. It is a one-sided surface like the surface of a Mobius band. Among the thousands of great mathematicians who assemble for a banquet is the second greatest, a Chinese man who invented zero. The greatest of them all, the person who discovered one, is not present because he or she lives on an upper level of heaven and is so revered that no one has seen his or her face. Only pie is served at the banquet. Why? Because pie models a circle, the most perfect of all figures.

The book ends with Robert, back in Bockel’s class, where he surprises the teacher by finding a rapid way to solve a problem. If Bockel gives a pretzel to one student, two to another, three to a third student and so on for 38 students, how many pretzels does he hand out?

Adults who know little about math will find this book as enlightening as will younger readers. It closes with a valuable index that lists in standard terminology all of the number devil’s topics.