In 1981, Erdős and Hajnal asked whether the sum of the reciprocals of the odd cycle lengths in a graph with infinite chromatic number is necessarily infinite. Let
C
(
G
)
\mathcal {C}(G)
be the set of cycle lengths in a graph
G
G
and let
C
o
d
d
(
G
)
\mathcal {C}_{\mathrm {odd}}(G)
be the set of odd numbers in
C
(
G
)
\mathcal {C}(G)
. We prove that, if
G
G
has chromatic number
k
k
, then
∑
ℓ
∈
C
o
d
d
(
G
)
1
/
ℓ
≥
(
1
/
2
−
o
k
(
1
)
)
log
k
\sum _{\ell \in \mathcal {C}_{\mathrm {odd}}(G)}1/\ell \geq (1/2-o_k(1))\log k
. This solves Erdős and Hajnal’s odd cycle problem, and, furthermore, this bound is asymptotically optimal.
In 1984, Erdős asked whether there is some
d
d
such that each graph with chromatic number at least
d
d
(or perhaps even only average degree at least
d
d
) has a cycle whose length is a power of 2. We show that an average degree condition is sufficient for this problem, solving it with methods that apply to a wide range of sequences in addition to the powers of 2.
Finally, we use our methods to show that, for every
k
k
, there is some
d
d
so that every graph with average degree at least
d
d
has a subdivision of the complete graph
K
k
K_k
in which each edge is subdivided the same number of times. This confirms a conjecture of Thomassen from 1984.