$PageTitle = "task3"; $PageHeading = "Open Round"; include "../files/user.php"; include "authenticate.php"; include "../header.php"; ?>
At this moment, you are not allowed access to the question.
} else { ?>
Copyright ©1968 United Features Syndicate.
The Linus sequence, inspired by this Peanuts cartoon, is a sequence using two symbols, traditionally 1 and 2 but we will use T and F. The sequence is uniquely defined by choosing each element so as to minimise the length of the longest repeated substring at the end of the sequence at that point. (A substring is a contiguous group of elements, and the string alfalfa ends with the repeated substring lfa.)
The first 5 elements of the Linus sequence are T F T T F (not quite the same as the cartoon). If we choose T to be the next symbol the sequence would end in a repeated 3-element substring T F T. If it was F the sequence would end in the repeated substring F (length 1), so F is the right choice as it avoids the longer repeat.
The Sally sequence is the length of the longest repeated substring suffix that was avoided by selecting the appropriate element. It begins 0 1 1 2 1 3 1....
Write a program that generates the first 200 elements of the Linus sequence, displaying them 20 elements per line with a space between each element, then the first 200 elements of the Sally sequence, again 20 per line with a space between them.
For the last 3 marks, determine (by any means) the largest value that occurs in the first 1200 elements of the Sally sequence. You may type this number in the output box, however all other output must be machine-generated.
You may submit multiple times. Only your most recent submission for each question will be marked.
References: The sequences were proposed by Nathaniel Hellerstein. They are A006345 and A006346 in the Online Encyclopedia of Integer Sequences. } include "../footer.php"; ?>