For a graph G of order n≥3 define P(k), 3≤k≤n, to be the following property: for all vertices x and y of G, where dG(x, y) is the distance between x and y in G. Geng-Hua Fan proved that if G is 2-connected and satisfies P(k), then G contains a cycle of length at least k. In this paper, we prove that if G is 2-connected, and G satisfies P(n−1) [resp. P(n)], then G is Hamiltonian [resp. pancyclic] with some exceptions. We prove also that if G is 3-connected and satisfies P(n+1), then G is Hamilton-connected.