RosettaCodeData/Task/Mian-Chowla-sequence/00-TASK.txt
2023-07-01 13:44:08 -04:00

64 lines
2.8 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

The [[wp:MianChowla sequence|MianChowla sequence]] is an integer sequence defined recursively.
MianChowla is an infinite instance of a [[wp:Sidon sequence|Sidon sequence]], and belongs to the class known as B₂ sequences.
The sequence starts with:
::<span style="font-style:italic;font-weight:bold;font-size:125%;">a<sub>1</sub> = 1</span>
then for <span style="font-style:italic;font-weight:bold;font-size:125%;padding:.3em;">n > 1,</span> <span style="font-style:italic;font-weight:bold;font-size:125%;padding:.3em;">a<sub>n</sub></span> is the smallest positive integer such that every pairwise sum
::<span style="font-style:italic;font-weight:bold;font-size:125%;">a<sub>i</sub> + a<sub>j</sub>
is distinct, for all <span style="font-style:italic;font-weight:bold;font-size:125%;">i</span> and <span style="font-style:italic;font-weight:bold;font-size:125%;">j</span> less than or equal to <span style="font-style:italic;font-weight:bold;font-size:125%;">n</span>.
;The Task:
:* Find and display, here, on this page the first 30 terms of the MianChowla sequence.
:* Find and display, here, on this page the 91st through 100th terms of the MianChowla sequence.
Demonstrating working through the first few terms longhand:
::<span style="font-style:italic;font-weight:bold;font-size:125%;">a<sub>1</sub> = 1</span>
::<span style="font-weight:bold;">1 + 1 = 2</span>
Speculatively try <span style="font-style:italic;font-weight:bold;font-size:125%;padding:.3em;">a<sub>2</sub> = 2</span>
::<span style="font-weight:bold;">1 + 1 = 2</span>
::<span style="font-weight:bold;">1 + 2 = 3</span>
::<span style="font-weight:bold;">2 + 2 = 4</span>
There are no repeated sums so '''2''' is the next number in the sequence.
Speculatively try <span style="font-style:italic;font-weight:bold;font-size:125%;padding:.3em;">a<sub>3</sub> = 3</span>
::<span style="font-weight:bold;">1 + 1 = 2</span>
::<span style="font-weight:bold;">1 + 2 = 3</span>
::<span style="font-weight:bold;">1 + 3 = <span style="background-color:yellow;">4</span></span>
::<span style="font-weight:bold;">2 + 2 = <span style="background-color:yellow;">4</span></span>
::<span style="font-weight:bold;">2 + 3 = 5</span>
::<span style="font-weight:bold;">3 + 3 = 6</span>
Sum of '''4''' is repeated so '''3''' is rejected.
Speculatively try <span style="font-style:italic;font-weight:bold;font-size:125%;padding:.3em;">a<sub>3</sub> = 4</span>
::<span style="font-weight:bold;">1 + 1 = 2</span>
::<span style="font-weight:bold;">1 + 2 = 3</span>
::<span style="font-weight:bold;">1 + 4 = 5</span>
::<span style="font-weight:bold;">2 + 2 = 4</span>
::<span style="font-weight:bold;">2 + 4 = 6</span>
::<span style="font-weight:bold;">4 + 4 = 8</span>
There are no repeated sums so '''4''' is the next number in the sequence.
And so on...
;See also:
:* [[oeis:A005282|OEIS:A005282 Mian-Chowla sequence]]