You are here

In Code: A Mathematical Journey

Sarah Flannery with David Flannery
Workman Publishing Company
Publication Date: 
Number of Pages: 
[Reviewed by
Marvin Schaefer
, on

At last! Here is a multifaceted book that is truly inspiring — inspiring to the parent in us, to the teacher in us, to the student in us, and to we who know and love the problem-solving obsession mathematics can often provide. The book is about the development of mathematical passion and excellence. The exposition, a joint collaboration of Sarah Flannery, then a secondary school girl, and her father, David, is clearly written and is exceptional for its bare and realistic honesty.

In this review, you will find a short summary of the narrative story, Sarah's mathematical development and maturation, the book's mathematics, and a little about her projects' evolution.

At its simplest level, this book is the story of Sarah Flannery, an Irish girl, who at the age of 15 was talked by one of her teachers into entering the annual national science fair to be held in Dublin a few months later, in January. Her father suggested she enter a mathematics project that investigated cryptography. This was her first science fair, and her initial entry into the January 1998 Irish Young Scientist Exhibition received a first place in the Individual Intermediate Mathematics, Physics and Chemistry division. Along with this prize, she was chosen to represent Ireland at the Intel International Science and Engineering Fair (ISEF), which took place in Fort Worth that May. Sarah continued her independent studies and her new ISEF entry won a third-place Karl Menger Memorial Award from the American Mathematical Society, a fourth-place Grand Award in Mathematics, and the prestigious $2000 Intel Fellows Achievement Award.

Following considerable additional study, and now 16 years old, Sarah produced a new project and won the IR£1000 first place in the 1999 Irish Young Scientist Exhibition for her entry in the Mathematics, Physics and Chemistry competition, and thence in September to Thessalonìki where she become a first-place winner of the 1999 European Union Young Scientist Award. Along with her European Young Scientist Award, Sarah was given an invitation to attend the Nobel Prize ceremonies in Stockholm. Fame, trophies, and media attention came following her 1999 Irish Young Scientist award, and Sarah was invited to lecture internationally on mathematics, puzzle solving, and on her projects.

Sarah Flannery is the eldest of five children. She lives rurally in a farmhouse near Blarney, near Cork, Ireland. However, it is not a typical farm household. Sarah and her four brothers live with their parents, David and Elaine, who respectively lecture in mathematics and microbiology at the Cork Institute of Technology (CIT). There is a blackboard in their kitchen, and it is on this blackboard that David has posed mathematical puzzles for his children to solve. The puzzles were clearly chosen to bring the children into enjoying abstract reasoning. They included magic square construction, crossing the river with lion, goat and cabbage, liquid-measuring with various containers, etc. And take note: Sarah does not fit the nose-always-in-a-book nerd stereotype. She rides horses, plays basketball and hurling, boating, and other outdoor and team sports.

On Tuesday nights, David conducts a non-credit course at CIT called Mathematical Excursions. The course has minimal prerequisites and explores popular and recreational mathematical themes. David has allowed Sarah to participate in the three-hour sessions. It is here that she became familiar with modular arithmetic, elementary number theory and monoalphabetic-substitution cryptography, and the RSA public-key algorithm.

When she was 15, Sarah entered her "transition year" in the Irish secondary school system. This is an optional year during which students can investigate a large number of subjects prior to going on to the final two years of more concentrated study. David's suggestion for Sarah's first Young Scientist project was that she program several cryptographic algorithms and demonstrate encryption and decryption using two laptops. Sarah did this using Mathematica. Using handmade cardboard coding disks and other props, she was able to explain her project to the judges and to answer their questions about how everything worked. By no means did she simply make props and code the algorithms: she learned the underlying mathematics. For example, to help her understand the workings of implementing the RSA algorithm, David found relevant papers for her to read. As a 15-year old, it took her many weeks of diligent study to master A. R. Meijer's "Groups, Factoring and Cryptography," Math. Mag. 69 (1996), pp. 103-109.

As part of her transition year, Sarah was given the opportunity to work in industry for two weeks. After winning the '98 Young Scientist award, Sarah worked at Baltimore Technologies' Dublin office where she was assigned to read a paper describing an algorithm by one of their cryptologists, vacationing Michael Purser. This algorithm, designed to speed-up computationally the RSA algorithm, substituted noncommutative multiplications over the quaternions for the RSA's more costly exponentiations. Sarah was asked to implement a prototype of Purser's algorithm, which she did in Mathematica.

Sarah asked and received permission from Baltimore Technologies to modify this algorithm and use it as part of her May entry in the ISEF. David showed Sarah the noncommutative multiplicative properties of matrices, and she implemented a demonstration of the modified algorithm using 2x2 matrices for Fort Worth. David had her read several additional papers and mathematical biographies, and she learned of Cayley's early work. Sarah continued evolving the project after the ISEF, and matured the coding, the algorithm and the presentation for her entry for the 1999 Young Scientist Exhibition. At this point she asked permission and named her new algorithm Cayley-Purser, or CP.

The CP algorithm's speed was compared to that of RSA in her project, and her conclusion was that CP runs approximately 22 times faster than RSA. Sarah's paper presents the mathematics underlying both algorithms as well as empirical results. While Sarah's paper conjectured that the algorithm was secure, it left open the possibility that it might be flawed. After winning Young Scientist '99, the CP algorithm came under close scrutiny and a crucial flaw was identified by a mathematician at University College Dublin and by Purser and William Whyte of Baltimore Technologies. A consequence of the Cayley-Hamilton Theorem, the flaw is intrinsic to the algorithm, and it was a painful experience for Sarah to realize that her algorithm was not secure after all. This left Sarah with the problem of how to present her work in Thessalonìki in June. Sarah's decision was to keep the discovered flaw secret prior to the European Union Young Scientist Exhibition, but to include a full disclosure and explanation of the flaw as an appendix to her entry's paper. She did, and the entry won. Sarah called her winning project "Cryptography-A New Algorithm Versus the RSA." Its text can be found in one of the book's appendices and also at

As mentioned above, Sarah's achievements were greeted with a great deal of media attention. Even the London Times waxed poetic in their promotion of Sarah to the stature of mathematical genius and her work to a revolutionary and patentable technology. As detailed in the book, the attention and such gushingly imprecise reporting caused Sarah, David and her mentors at Baltimore Technologies some embarrassments and difficulties. It was here that I believe the book really shines. Flannery père et fille make no bones about stating that Sarah is a bright young woman, but not a genius. Thanks to David, Sarah has read Men of Mathematics and the biographies of many mathematicians. She knows what Gauss and Euler achieved in their youth, and she understands that what she has been doing is not of that calibre. She also knows about the important history of counterexamples in mathematics as well as in cryptology. There is no false modesty here. Sarah's frank voice rings very true and maturely on these points, and I believe these aspects are the best reasons for giving this book to bright young students.

The book was originally published in the UK by Profile Books, who did not flinch at the prospect of producing a book about a young celebrity that included a lot of equations. The initial Flannery collaboration included a selection of the puzzles that had intrigued Sarah along with their solutions (many of these are developed in the text while others are teasingly presented in the back of the book).

The US publisher, Workman, responded to criticism of the Profile edition and asked for even more mathematics to be included. The result is a narrative that is interrupted by several long sections that explain: the Euclidean algorithm, sieve of Eratosthenes, complexity of factoring, distribution of primes, the Chinese Remainder Theorem, Fermat's little theorem, pseudoprimes, casting out nines, matrix arithmetic and inversion, Sarah's conjecture on the order of GL(2, Zp), etc. With few exceptions, these expositions are complete and should be within the grasp of US high school students. The revision for the US edition was written while Sarah was particularly busy in school, and so David was largely responsible for much of the newer mathematical exposition. This decision showed considerable courage on Workman's part — a cursory scan of Workman's publications catalogue shows no mathematics books and only very light popularisations of science writing. There is one obvious error in the text (on page 136, the calculated 2860 should be 103) and the publisher's typesetter introduced several syntactical errors in the Mathematica code.

Now 20, Sarah has entered her second year of studies at Cambridge, where she is enrolled in a theoretical computing science curriculum.









Marvin Schaefer ( is a computer security expert and was chief scientist at the National Computer Security Center at the NSA, and at Arca Systems. He has been a member of the MAA for 39 years and now operates an antiquarian book store called Books With a Past.

The table of contents is not available.