[seqfan] Re: I need help with defining these 3 sequences

M. F. Hasler oeis at hasler.fr
Sun Mar 1 21:52:42 CET 2020


On Sun, Mar 1, 2020 at 2:30 AM Ali Sada wrote:

> Sequence 1: We distribute the natural numbers on “cycles.” The first cycle
> has only one element (1), the second cycle has two elements (2,3), the
> third cycle has three elements (4,5,6), etc.
> 1
> 2,3
> 4,5,6
> 7,8,9,10
> 11,12,13,14,15
>

The n-th "cycle" is the interval [T(n)+1 .. T(n+1)] where T(n)=n(n+1)/2 are
the triangular numbers A000217;
the above triangle is also what is called T(k,j) = T(k-1)+j , 1 <= j <= k,
in A000027, comment from Nov 19 2009.

We start with a(1)=1. Then a(2) is the first element in the second cycle.
> a(2) = 2.
> Since a(2)=2, then a(3) is the second element in the third cycle. a(3) = 5.
> a(4) is the fifth element in the fourth cycle, and that would be 7 (since
> we have only 4 elements then the cycle goes back to the first element.)
> a(4) = 7
> a(5) is the seventh element in the fifth cycle and that would be 12.
>

a(1) = 1; for n>1, a(n) = T(n, a(n-1) %% n) where  x %% y := (x-1 mod y)+1
to get 1,...,y,1,...,y etc.
or explicitly: a(n) = n(n-1)/2 + (a(n-1)-1 mod n) + 1.

(PARI) for(n=2,#a=Vec(1,100), a[n]=n*(n-1)/2 + (a[n-1]-1)%n + 1);a
 = [1, 2, 5, 7, 12, 21, 28, 32, 41, 46, 57, 75, 88, 95, 110, 134, 151, 160,
179, 209, 230, 241, 264, 300, 325, ...]
differs from your:

This is the sequence we get.
> 1, 2, 5, 7, 12, 21, 28, 32, 45, 50, 61, 67, 80, 101, 116, 124, 141, 168,
> 187, 197, 218, 251, 274, 286, 311, 350, 377, 391, 420, 465, 496
>

in a(9) = the 32-th element of "cycle 9" = 37..45 of length 9 = the (32 %%
9)-th element = the 31%9+1 = 5-th element, 36+5 = 42.

- Maximilian



More information about the SeqFan mailing list