How to defined a function that generates a sequence by from the sequence passed as the third argument by taking the number of values passed as the first arguments and applyi