# How can this custom function generate the corresponding arithmetic sequence?

**URL:** <https://community.wolfram.com/t/how-can-this-custom-function-generate-the-corresponding-arithmetic-sequence/24327>\
**Category:** Questions\
**Created:** [July 16, 2024, 9:46am UTC](https://community.wolfram.com/t/how-can-this-custom-function-generate-the-corresponding-arithmetic-sequence/24327 "2024-07-16T09:46:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![csn899](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@csn899](https://community.wolfram.com/u/csn899)\
**Post date:** [July 16, 2024, 9:46am UTC](https://community.wolfram.com/t/how-can-this-custom-function-generate-the-corresponding-arithmetic-sequence/24327/1 "2024-07-16T09:46:42Z")

</div>

A function is to be constructed that, given an input of a positive integer value m, automatically enumerates all possible cases. Starting with an arithmetic sequence of length 4\*m + 2, two terms are removed leaving 4m terms, which are then evenly divided into m groups, each consisting of 4 numbers. It is required that the 4 numbers in each group form their own arithmetic sequence. The function should generate all combinations of the two removed terms and the corresponding m groups of four numbers forming arithmetic sequences.

To clarify the problem statement further, let’s break down the requirements:

1. An arithmetic sequence of length 4\*m + 2 is created.

2. Two terms from this sequence are removed.

3. The remaining 4m terms are divided into m groups, each containing exactly 4 terms.

4. Each of these groups must also be an arithmetic sequence.

5. The function should output all possible combinations of the two removed terms and the resulting groups of four numbers that form arithmetic sequences.

After providing the corresponding positive integer value of m, the above code has missing sequence issues upon execution, how should the code be modified?

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [July 16, 2024, 5:18pm UTC](https://community.wolfram.com/t/how-can-this-custom-function-generate-the-corresponding-arithmetic-sequence/24327/2 "2024-07-16T17:18:25Z")

</div>

I cannot detect issues. For what `m` do you get them?
