Sophie Germain was a French mathematician that lived from 1776 to 1831. Highly motivated, curious and mainly self-taught from the books in her father's library, she pursued the independent study of mathematics for the love of the subject. She lived during a time when the field of mathematics was dominated by men and therefore, she wrote papers under the pseudonym of M. Le Blanc to hide her gender.

She corresponded with several famous mathematicians of her time, including Lagrange, Legendre and the legendary Carl Friedrich Gauss. Eventually, mathematicians such as Gauss and Lagrange learned her true identity and praised her work on the topics of number theory and elasticity.

Let us look at one type of number named after her:

*In number theory, a prime number p is a Sophie Germain prime if 2p + 1 is also prime.*

For example, the number 5 is a Sophie Germain prime because 5 is prime and so is 11.

2(5) + 1 = 11

In Common Lisp, we can write a *predicate*, **sophiep**, that tests for this quality. (We assume we have another predicate **primep** that can test for primality.

```
(defun sophiep (n)
"is n a Sophie Germain Prime?"
(if (and (primep n)
(primep (+ (* 2 n) 1)))
t))
```

Using the loop macro, we can easily generate a list of Sophie Germain primes between two values:

```
(loop for n from 1 to 100
when (sophiep n) collect n)
```

`(2 3 5 11 23 29 41 53 83 89)`

This simple example, shows the usefulness of Common Lisp as a free tool that can be used to learn and explore *Discrete Mathematics* without requiring proprietary math software.

__References__

__References__Musielak, D. (2015). *Prime mystery: The life and mathematics of Sophie Germain*. AuthorHouse.

En.wikipedia.org. 2022. *Sophie Germain - Wikipedia*. [online] Available at: <https://en.wikipedia.org/wiki/Sophie_Germain>

## Comments