cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A269501 Subsequence immediately following the instances of n in the sequence is n, n-1, ..., 1, n+1, n+2, ....

This page as a plain text file.
%I A269501 #45 Nov 16 2024 22:15:18
%S A269501 1,1,2,2,1,3,3,2,3,1,4,4,3,4,2,4,1,5,5,4,5,3,5,2,5,1,6,6,5,6,4,6,3,6,
%T A269501 2,6,1,7,7,6,7,5,7,4,7,3,7,2,7,1,8,8,7,8,6,8,5,8,4,8,3,8,2,8,1,9,9,8,
%U A269501 9,7,9,6,9,5,9,4,9,3,9,2,9,1,10,10,9,10,8,10,7,10,6,10,5,10,4,10,3,10,2,10,1
%N A269501 Subsequence immediately following the instances of n in the sequence is n, n-1, ..., 1, n+1, n+2, ....
%C A269501 The sequence includes every ordered pair of positive integers exactly once as consecutive terms of the sequence. Through n = k^2, it has every pair i,j with 0 < i,j <= k.
%C A269501 Can be regarded as an irregular triangle where row k contains 1, k, k, k-1, k, k-2, ..., 2, k, with 2n-1 terms.
%C A269501 See A305615 for an essentially identical sequence: a(n) = A305615(n)+1. - _N. J. A. Sloane_, Jul 03 2018
%F A269501 Let r = ceiling(sqrt(n)) = A003059(n). If n and r have the same parity, a(n) = (r^2-n)/2 + 1; otherwise a(n) = r.
%e A269501 The first 3 occurs as a(5), so a(6) = 3, the first term of 3, 2, 1, 4, 5, 6, .... The second 3 is thus a(6), so a(7) = 2. The third 3 is a(8), so a(9) = 1. The fourth 3 is a(12), now we start incrementing, and a(13) = 4.
%e A269501 The triangle starts:
%e A269501   1
%e A269501   1, 2, 2
%e A269501   1, 3, 3, 2, 3
%e A269501   1, 4, 4, 3, 4, 2, 4
%e A269501   1, 5, 5, 4, 5, 3, 5, 2, 5
%o A269501 (PARI) a(n) = my(r = if(n<=0, 0, sqrtint(n-1)+1));if((n-r)%2,r,(r^2-n)/2 + 1)
%Y A269501 Cf. A003059, A060747 (row lengths), A000326 (row sums), A097291, A269780.
%Y A269501 See also A315615.
%K A269501 nonn,tabf
%O A269501 0,3
%A A269501 _Franklin T. Adams-Watters_, Mar 04 2016