1 | initial version |

Given that $(n + p) = n^2 \mbox{ mod } p$, you just have to compute the numbers $n^2 { mod } p$ for all integers between $0$ and $p-1$. If you want to avoid repetitions, you just have to put them in a set. Here is how:

```
sage: p = 17
sage: S = {n^2 % p for n in range(p)}
sage: S
{0, 1, 2, 4, 8, 9, 13, 15, 16}
sage: p = 123457
sage: S = {n^2 % p for n in range(p)}
sage: len(S)
61729
```

2 | No.2 Revision |

Given that $(n + p) = n^2 \mbox{ mod } p$, you just have to compute the numbers $n^2 ~~{ ~~\mbox{ mod } p$ for all integers between $0$ and $p-1$. If you want to avoid repetitions, you just have to put them in a set. Here is how:

```
sage: p = 17
sage: S = {n^2 % p for n in range(p)}
sage: S
{0, 1, 2, 4, 8, 9, 13, 15, 16}
sage: p = 123457
sage: S = {n^2 % p for n in range(p)}
sage: len(S)
61729
```

3 | No.3 Revision |

Given that $(n + ~~p) ~~p)^2 = n^2 + 2np + p^2 = n^2 \mbox{ mod } p$, you just have to compute the numbers $n^2 \mbox{ mod } p$ for all integers between $0$ and $p-1$. If you want to avoid repetitions, you just have to put them in a set. Here is how:

```
sage: p = 17
sage: S = {n^2 % p for n in range(p)}
sage: S
{0, 1, 2, 4, 8, 9, 13, 15, 16}
sage: p = 123457
sage: S = {n^2 % p for n in range(p)}
sage: len(S)
61729
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.