5-2.1594.pdf

# 5-2.1594.pdf - 4723 Ducci Sequence Asia Seoul 2009/2010 A...

• Test Prep
• 2

This preview shows page 1 - 2 out of 2 pages.

4723 - Ducci Sequence Asia - Seoul - 2009/2010 A Ducci sequence is a sequence of n -tuples of integers. Given an n -tuple of integers ( a 1 , a 2 , ... , a n ), the next n -tuple in the sequence is formed by taking the absolute differences of neighboring integers: ( a 1 , a 2 , ... , a n ) (| a 1 - a 2 |,| a 2 - a 3 |, ... ,| a n - a 1 |) Ducci sequences either reach a tuple of zeros or fall into a periodic loop. For example, the 4-tuple sequence starting with 8,11,2,7 takes 5 steps to reach the zeros tuple: (8, 11, 2, 7) (3, 9, 5, 1) (6, 4, 4, 2) (2, 0, 2, 4) (2, 2, 2, 2) (0, 0, 0, 0). The 5-tuple sequence starting with 4,2,0,2,0 enters a loop after 2 steps: (4, 2, 0, 2, 0) (2, 2, 2, 2, 4) ( 0, 0, 0, 2, 2 ) (0, 0, 2, 0, 2) (0, 2, 2, 2, 2) (2, 0, 0, 0, 2) (2, 0, 0, 2, 0) (2, 0, 2, 2, 2) (2, 2, 0, 0, 0) (0, 2, 0, 0, 2) (2, 2, 0, 2, 2) (0, 2, 2, 0, 0) (2, 0, 2, 0, 0) (2, 2, 2, 0, 2) (0, 0, 2, 2, 0) (0, 2, 0, 2, 0) (2, 2, 2, 2, 0) ( 0, 0, 0, 2, 2 ) ... Given an n -tuple of integers, write a program to decide if the sequence is reaching to a zeros tuple or a periodic loop. Input Your program is to read the input from standard input. The input consists of

#### You've reached the end of your free preview.

{[ snackBarMessage ]}

###### "Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern