For example , ( 1 , 2 , 3 , 4 , 5 ) is a finite sequence . A more formal definition of a finite sequence with terms in a set S is a function from to S for some n ) 0 . An infinite sequence in S is a function from to S. For example , the sequence of prime numbers ( 2,3,5,7,11 , â ) is the function 1 â ' 2 , 2 â ' 3 , 3 â ' 5 , 4 â ' 7 , 5 â ' 11 , â .