login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A161810
a(n) is the maximum possible length of a sequence consisting of integers [0..n-1] such that no two nonempty adjacent segments of the same length have the same sum modulo n.
0
1, 3, 7, 16, 33, 35, 47, 61
OFFSET
1,2
COMMENTS
The original source for this sequence was the problem 'perlbrac' in the 2009 USACO Holiday Contest (http://ace.delos.com/HOL09) which asked contestants to find the longest sequences of this type that they possibly could. a(n) is the upper bound on the length of such a sequence for a given n.
FORMULA
Replacing each element x of a solution by ((a x + b) mod n) also gives a solution if gcd(a,n) = 1. - Bert Dobbelaere, Apr 18 2019
EXAMPLE
For example, in the sequence 0, 1, 2, 1, 0, 1, 2 (length 7) consisting of integers in the range [0..2], no two adjacent segments of equal length (e.g., 0, 1, 2 and 1, 0, 1) have the same sum modulo 3. There is also no longer sequence with this property, hence a(3) = 7.
From Bert Dobbelaere, Apr 18 2019: (Start)
Lexicographically earliest solutions represented as digit strings.
n a(n)
1 1 0
2 3 010
3 7 0102010
4 16 0130102013101201
5 33 010214243213143040102142432131430
6 35 01024021240241402401024021240241402
7 47 01021614636032312426404301021614636032312426404
8 61 0120135461316135364357463523745020571465756571764713467127313
(End)
CROSSREFS
Sequence in context: A376334 A298311 A366527 * A318604 A084631 A219846
KEYWORD
hard,more,nonn
AUTHOR
Brian Bi (bbi5291(AT)gmail.com), Jun 19 2009
EXTENSIONS
Definition and source corrected by Brian Bi (bbi5291(AT)gmail.com), Sep 19 2009
a(7)-a(8) from Bert Dobbelaere, Apr 18 2019
STATUS
approved