Test code for calculating values relating to sequences