login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A333068 a(1) = 1; for n > 1, a(n) = n*(n-1)/2 + ((a(n-1)-1) mod n) + 1, the a(n-1)-th term of the n-th row of the triangle of positive integers, indexed in cyclic manner. 0
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, 338, 365, 379, 408, 453, 484, 500, 533, 584, 619, 637, 674, 731, 770, 790, 831, 894, 937, 959, 1004, 1073, 1120, 1144, 1193, 1268, 1319, 1345, 1398 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Write the positive integers A000027 in a triangle T(k,j) = k(k-1)/2 + j, k >= j >= 1. Then a(n) is the a(n-1)-th element of the n-th row, with indices taken in [1..n] modulo n. (If a row has fewer than a(n-1) elements, this is equivalent to repeating the elements in a cyclic/periodic manner up to the required length.)
LINKS
EXAMPLE
Consider the positive integers written in a triangle, the n-th row going from n(n-1)/2 + 1 to n(n+1)/2 = A000217(n):
row k numbers T(k,j) = k(k-1)/2 + j, j = 1..k
----- ---------------------------------------
1 1;
2 2, 3;
3 4, 5, 6;
4 7, 8, 9, 10;
5 11, 12, 13, 14, 15;
etc.
After a(1) = 1, a(2) is the 1st term of the 2nd row of the triangle, a(2) = 2.
Then a(3) is the a(2)-th = 2nd term of the 3rd row, a(3) = 5.
Then a(4) is the a(3)-th = 5th term of row 4, with cyclic indexing: since the row has only 4 elements, we wrap around in a cyclic manner and come back to the 1st term, a(4) = 7.
Similarly, a(5) = 8 is the a(4)-th = 7th term of the 5th row, with cyclic indexing (so actually the 2nd term).
a(9) is the 32nd term of row 9 = 37..45 of length 9, i.e., taking modulo 9, the 5th term, 36+5 = 41.
MAPLE
a:= proc(n) option remember; `if`(n<2, n,
n*(n-1)/2 + ((a(n-1)-1) mod n) + 1)
end:
seq(a(n), n=1..60); # Alois P. Heinz, Apr 23 2020
MATHEMATICA
a[n_] := a[n] = If[n<2, n, n(n-1)/2 + Mod[a[n-1]-1, n] + 1];
Array[a, 60] (* Jean-François Alcover, Nov 30 2020, after Alois P. Heinz *)
PROG
(PARI) for(n=2, #a=Vec(1, 100), a[n]=n*(n-1)/2 + (a[n-1]-1)%n + 1); a
CROSSREFS
Sequence in context: A042065 A041793 A359064 * A029938 A213044 A269769
KEYWORD
nonn
AUTHOR
Ali Sada and M. F. Hasler, Mar 06 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 14:32 EDT 2024. Contains 371960 sequences. (Running on oeis4.)