This site is supported by donations to The OEIS Foundation.

# Fermat's triangle

Fermat’s triangle
 T  (n, m) = m mod n

 n

 n   −  1

 m  = 1
m  φ (n) mod n

2   1
1
3   1 1
2
4   1 0 1
2
5   1 1 1 1
4
6   1 4 3 4 1
13
7 1 1 1 1 1 1
6
8   1 0 1 0 1 0 1
4
9   1 1 0 1 1 0 1 1
6
10   1 6 1 6 5 6 1 6 1
33
11   1 1 1 1 1 1 1 1 1 1
10
12 1 4 9 4 1 0 1 4 9 4 1
38
13   1 1 1 1 1 1 1 1 1 1 1 1
12
14   1 8 1 8 1 8 7 8 1 8 1 8 1
61
15   1 1 6 1 10 6 1 1 6 10 1 6 1 1
52
16 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
8

 m = 1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
A066340: Fermat’s triangle:
 T  (n, m) = m  φ (n) mod n
, for
 n   ≥   2, 1   ≤   m   ≤   n  −  1
. (Concatenated rows of Fermat’s triangle.)
{1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 4, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 6, 1, 6, 5, 6, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 9, 4, 1, 0, 1, 4, 9, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...}
Per Fermat’s little theorem, the rows corresponding to prime
 n
consist of all 1s, although the converse is not true: rows corresponding to composite
 n
which consist of all 1s are the Carmichael numbers.

## Row sums

A?????? Row sums of Fermat’s triangle:
 n   −  1

 m  = 1
m  φ (n) mod n
, for
 n   ≥   2
.
{1, 2, 2, 4, 13, 6, 4, 6, 33, 10, 38, 12, 61, 52, 8, ...}
If
 n
is a prime power
 p  k, k   ≥   1,
the row sum is
n (
 p  −  1 p
)
. The converse is not true: if the row sum is
n (
 q  −  1 q
)
for some
 q   ≥   2
, it does not imply that
 n
is a prime power
 q k, k   ≥   1
.