The aim of the book is to teach mathematics students how to program using their knowledge of mathematics. For this they require only to know how to construct a proof. The entire book$\rq$s emphasis is on "how to think" when programming. Three methods for constructing an algorithm or a program are used: a) manipulation and enrichment of existing code; b) use of recurrent sequences; c) deferral of code writing, in order to deal with one difficulty at a time. Many theorems are mathematically proved and programmed. The last chapter explains how a compiler works and shows how to compile "by hand" little (but not trivial - even recursive) programs. The book is intended for anyone who thinks mathematically and wants to program and play with mathematics. Contents: Programming proverbs; Review of arithmetic; An algorithm description language; How to create an algorithm; Algorithms and classical constructions; The Pascal language; How to write a program; The integers; The complex numbers; Polynomials; Matrices; Recursion; Elements of compiler theory.