Originally Posted by

**Confushous** I am having trouble starting a program to compute the ekg. can anyone help

• Every number after that is the smallest number that is not in the sequence, and shares a factor larger than 1 with the last number

The first 10 numbers in the EKG sequence are

1,2,4,6,3,9,12,8,10,5

The program you turn in is to read in an integer n and compute and print the first n terms in the EKG sequence.

Your program should also include a function (or method) to compute GCD using Euclid’s algorithm (which is found on page 4 of your book). You are to use this function to determine if a candidate shares a factor larger than 1 with the last number in the sequence.