We consider the 1-dimensional reflected Brownian motion and 3-dimensional Bessel process and the general models. By decomposing the hitting times of consecutive sites into loops, we obtain identities, called loop identities, for the generating functions of the hitting times. After proving this decomposition both combinatorially and inductively, we consider the case that sites are equally distributed. Then, from loop identities, we derive expressions of Bernoulli and Euler polynomials, in terms of Euler polynomials of higherorders.