How do you compute up[v][j] for ? Use this recurrence:
up[v][j] = up[up[v][j-1]][j-1]
In words: to jump steps from , first jump steps (landing at up[v][j-1]), then jump another steps from there. Since , you have jumped the right distance. This is the same idea as repeated squaring in fast exponentiation. Break the big jump into two equal halves.