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.
%I A213194 #21 Feb 16 2025 08:33:17 %S A213194 1,1,1,2,2,3,1,1,2,2,3,3,4,4,5,1,1,2,2,3,3,4,4,5,5,6,6,7,1,1,2,2,3,3, %T A213194 4,4,5,5,6,6,7,7,8,8,9,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,1, %U A213194 1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10 %N A213194 First inverse function (numbers of rows) for pairing function A211377. %H A213194 Boris Putievskiy, <a href="/A213194/b213194.txt">Rows n = 1..140 of triangle, flattened</a> %H A213194 Boris Putievskiy, <a href="http://arxiv.org/abs/1212.2732">Transformations [of] Integer Sequences And Pairing Functions</a> arXiv:1212.2732 [math.CO], 2012. %H A213194 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a> %H A213194 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A213194 a(n) = (3*A002600(n)+A004736(n)-1-(-1)^A002260(n)+A003056(n)*(-1)^A003057(n))/4; %F A213194 a(n) = (3*i+j-1-(-1)^i+(i+j-2)*(-1)*t)/4, where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2). %e A213194 The start of the sequence as triangle array read by rows: %e A213194 1; %e A213194 1,1; %e A213194 2,2,3; %e A213194 1,1,2,2; %e A213194 3,3,4,4,5; %e A213194 1,1,2,2,3,3; %e A213194 4,4,5,5,6,6,7; %e A213194 1,1,2,2,3,3,4,4; %e A213194 5,5,6,6,7,7,8,8,9; %e A213194 1,1,2,2,3,3,4,4,5,5; %e A213194 . . . %e A213194 The start of the sequence as array read by rows, the length of row r is 4*r-3. %e A213194 First 2*r-2 numbers are from the row number 2*r-2 of above triangle array. %e A213194 Last 2*r-1 numbers are from the row number 2*r-1 of above triangle array. %e A213194 1; %e A213194 1,1,2,2,3; %e A213194 1,1,2,2,3,3,4,4,5; %e A213194 1,1,2,2,3,3,4,4,5,5,6,6,7; %e A213194 1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9; %e A213194 . . . %e A213194 Row r contains numbers 1,2,3,...2*r-2 repeated twice, row ends 2*r-1. %o A213194 (Python) %o A213194 t=int((math.sqrt(8*n-7) - 1)/ 2) %o A213194 i=n-t*(t+1)/2 %o A213194 j=(t*t+3*t+4)/2-n %o A213194 result=(3*i+j-1-(-1)**i+(i+j-2)*(-1)**(i+j))/4 %Y A213194 Cf. A211377, A002260, A004736, A003056, A003057. %K A213194 nonn %O A213194 1,4 %A A213194 _Boris Putievskiy_, Mar 01 2013