# [seqfan] Re: Does the first part of this algorithm work only with the powers of 2?

Thu Jan 9 17:37:42 CET 2020

``` Hi Elijah,

Thank you very much for your response. I really appreciate it. Very nice investigation!

My question to the OEIS team is: would the array resulted from this idea be suitable for the OEIS?

The array definition is:

A(n,1) = 1; A(n,k) = number of terms in the raw divisible by n+1 if A(n,k-1) is divisible by n+1; otherwise A(n,k) = A(n,k-1)+k.

Best,

Ali

On Wednesday, January 8, 2020, 8:43:26 PM EST, Elijah Beregovsky <elijah.beregovsky at gmail.com> wrote:

Hello, Ali!
As we’re dealing with multiples of m, it seems sensible to see what’s going on with the sequences modulo m, especially after the first rule stops working. After that point we just add consecutive natural numbers to whatever we had when the first rule broke (breaking point). So, actually we are interested in triangular numbers (increased by a fixed amount) modulo m. (mod 3) sequence of remainders of triangular numbers goes 0,1,0,0,1,0,0,1..., (mod 5) - 0,1,3,1,0,0,1,3,1,0,1,3..., (mod 6) - 0,1,3,0,4,3,3,4,0,3,1,0,0,1,3,0... So, it is periodic and not every remainder appears in the period. Thus, you can add some number to every term and get a sequence with no zeroes. That’s exactly what happens at the breaking point. And it always happens, as you run through all naturals (number of multiples of m), until you find one, that gives you a non-zero remainder sequence. On the other hand, when you take triangular numbers (mod 2^i) you get all possible remainders: (mod 4) 0,1,3,2,2,3,1,0,0,1... So, when you add any k to every number in that sequence you still get every remainder, so zero’s always present and no breaking occurs.
The fact, that for powers of 2 you get every possible remainder, is proved here: https://fgiesen.wordpress.com/2015/02/22/triangular-numbers-mod-2n/
The fact, that for everything else, some remainder is missing, is discussed here: https://math.stackexchange.com/questions/2154530/triangular-numbers-modulo-k-hit-all-values
Thanks for this question, it was interesting to investigate,
Elijah

--
Seqfan Mailing list - http://list.seqfan.eu/

```