What are some math books written in dialogue or story form, e.g., a teacher explaining to a student? Good examples would be The Square Root of 2 by David Flannery or Math Girls by Hiroshi Yuki.
 A: Galileo's Dialogue Concerning the Two Chief World Systems is the patriarch of this genre.
There is a math book (not the Lockhart essay, but I do not remember the title), that uses Galileo's antagonists Simplicio and Salviati to explain the material through a series of dialogues.
A: I'm not sure if they they have the exact form that you want, but they have mathematics, dialogue and story:


*

*The Manga Guide to Statistics

*The Manga Guide to Linear Algebra

*The Manga Guide to Calculus
Remark 1: There are other titles on Databases, Electricity, Physics, Molecular Biology, Relativity, Universe, Biochemistry.
Remark 2: I didn't read these books and I have no idea if they are a good. The only thing that I know about them is that they do exist.
A: Don' t forget Euclid and his Modern Rivals by  Charles Lutwidge Dodgson (1832–1898), better known as Lewis Carroll. 
https://en.wikipedia.org/wiki/Euclid_and_his_Modern_Rivals
It is sometimes said that it was a play , not sure if it was ever preformed on stage
A: I would recommend "Proofs and Refutations" by Imre Lakatos. It is not so much a real story as a series of dialogs between students in a classroom, nicely illustrating much of the mathematician's handiwork.
A: A Certain Ambiguity is a book by Gaurav Suri and Hartosh Singh Bal. Although it is a novel, it addresses some very deep parts of mathematics, including Euclid's Fifth Postulate and the concept of infinity. Because it is a novel, most of the mathematics is explained in the dialogue from one character to another. 
A: I don't know if there are any particular topics you're interested in, or at what level of detail you want them presented, but Knuth's Surreal Numbers is an example of the sort of book you mean: 

B. You mean we're actually using the New Math to decipher this old
  stone tablet?
A. I hate to admit it, but that's what it looks like. Here the first
  rule says that every number $x$ is a pair of sets called the left set
  $x_L$ and the right set $x_R$: $$x=\langle x_L,x_R\rangle.$$
B. Hold it, your notation mixes me up. I don't know what's a set and what's a number.

A: They are written in Italian, so I don't know how many people may enjoy them, but Roberto Zanasi wrote two books in form of a dialogue between a Vero matematico ("True mathematician") an an apprentice:
Verso l'infinito, ma con calma (To the infinite, but with ease), about infinity in mathematics
Un punto fermo (An anchor), about invariants.
A: Heyting's Intuitionism: An Introduction begins with a dialogue between proponents of different schools of mathematical philosophy.
A: I quite like the Life of Fred Math books.  The math is all taught by having the main character, Fred, encounter situations where he requires the math principle.
A: The Number Devil: A Mathematical Adventure Is very good; It explains complex concepts in ways simple enough that young children can understand them, yet complex enough to maintain an adults attention with the revelations and connections it provides.
A: I don't know if it counts as a math book, but Hofstadter's "Gödel, Escher, Bach" contains a large number of very entertaining dialogues that help to explain concepts in logic such as Gödel's incompleteness theorems, usually disguised in the form of some kind of fable involving Achilles and the tortoise.
A: Flatland by Edwin A. Abbot comes to mind. It is an "easy" introduction to higher dimensions.  
Flatterland is probably more mathematical, though.  It introduces many modern concepts like topology, hyperspace, etc. and is indeed like a teacher (the "Space Hopper") explaining to a student (the 2D being Victoria Line).
A: Barron's has 3 books that are in story form. The story in these actually builds on each other and they can be read in this order:


*

*Algebra The Easy Way

*Trigonometry The Easy Way

*Calculus The Easy Way

A: The Man Who Counted
From Wikipedia:
The Man Who Counted (original Portuguese title: O Homem que Calculava) is a book on recreational mathematics and curious word problems by Brazilian writer Júlio César de Mello e Souza, published under the pen name Malba Tahan. Since its first publication in 1938,[1] the book has been immensely popular in Brazil and abroad, not only among mathematics teachers but among the general public as well.
The book has been published in many other languages, including Catalan, English (in the UK and in the US),[2] German, Italian, and Spanish, and is recommended as a paradidactic source in many countries.
A: I just came across Math Dialogue: Functions which states that it «is a very gentle introduction to the concept of the function, written in form of a dialogue.» I did not read it, though.
A: I know I'm a bit late, but I recently came across the lovely book Treks into Intuitive Geometry, which consists of a series of conversations between Gen and Kyu, as can be seen in the image below. The whole book appears to be written in this format.

A: Lawvere and Schanuel, Conceptual Mathematics: A first introduction to categories has many such passages, reflecting the classroom atmosphere from when the material was first taught.
