It wouldn't be too much of a stretch to detect and optimise away code that computes linearly recurrent sequences.