Let
A
\mathcal {A}
be a set of nonnegative integers, and let
r
2
A
(
n
)
r_2^\mathcal {A}(n)
denote the number of representations of n in the form
n
=
a
i
+
a
j
n = {a_i} + {a_j}
with
a
i
,
a
j
∈
A
{a_i},{a_j} \in \mathcal {A}
. The set
A
\mathcal {A}
is periodic if
a
∈
A
a \in \mathcal {A}
implies
a
+
m
∈
A
a + m \in \mathcal {A}
for some
m
⩾
1
m \geqslant 1
and all
a
>
N
a > N
. It is proved that if
A
\mathcal {A}
is not periodic, then for every set
B
≠
A
\mathcal {B} \ne \mathcal {A}
there exist infinitely many n such that
r
2
A
(
n
)
≠
r
2
B
(
n
)
r_2^\mathcal {A}(n) \ne r_2^\mathcal {B}(n)
. Moreover, all pairs of periodic sets
A
\mathcal {A}
and
B
\mathcal {B}
are constructed that satisfy
r
2
A
(
n
)
=
r
2
B
(
n
)
r_2^\mathcal {A}(n) = r_2^\mathcal {B}(n)
for all but finitely many n.