example 6-2: calculating series