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 A213928 #20 Mar 23 2025 18:43:20 %S A213928 1,4,2,5,3,9,16,6,8,10,25,15,7,11,17,26,24,14,12,18,36,49,27,23,13,19, %T A213928 35,37,64,48,28,22,20,34,38,50,65,63,47,29,21,33,39,51,81,100,66,62, %U A213928 46,30,32,40,52,80,82,121,99,67,61,45,31,41,53,79,83,101 %N A213928 Natural numbers placed in table T(n,k) layer by layer. The order of placement - at the beginning 2 layers counterclockwise, next 1 layer clockwise and so on. T(n,k) read by antidiagonals. %C A213928 Permutation of the natural numbers. a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.In general, let b(z) be a sequence of integer numbers. Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1). Natural numbers placed in table T(n,k) layer by layer. The order of placement - layer is counterclockwise, if b(z) is odd; layer is clockwise if b(z) is even. T(n,k) read by antidiagonals.For A219159 - the order of the placement - at the beginning m layers counterclockwise, next m layers clockwise and so on - b(z)=floor((z-1)/m)+1. For this sequence b(z)=z^2 mod 3. %H A213928 Boris Putievskiy, <a href="/A213928/b213928.txt">Rows n = 1..140 of triangle, flattened</a> %H A213928 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 A213928 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing functions</a> %H A213928 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A213928 For general case. %F A213928 As table %F A213928 T(n,k) = ((1+(-1)^(b(k)-1))*(k^2-n+1)-(-1+(-1)^(b(k)-1))*((k-1)^2 +n))/2, if k >= n; %F A213928 T(n,k) = ((1+(-1)^b(n))*(n^2-k+1)-(-1+(-1)^b(n))*((n-1)^2 +k))/2, if n >k. %F A213928 As linear sequence %F A213928 a(n) = ((1+(-1)^(b(j)-1))*(j^2-i+1)-(-1+(-1)^(b(j)-1))*((j-1)^2 +i))/2, if j >= i; %F A213928 a(n) = ((1+(-1)^b(i))*(i^2-j+1)-(-1+(-1)^b(i))*((i-1)^2 +j))/2, if i >j; %F A213928 where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2). %F A213928 For this sequence b(z)=z^2 mod 3. %F A213928 As table %F A213928 T(n,k) = ((1+(-1)^(k^2 mod 3-1))*(k^2-n+1)-(-1+(-1)^(k^2 mod 3-1))*((k-1)^2 +n))/2, if k >= n; %F A213928 T(n,k) = ((1+(-1)^(n^2 mod 3))*(n^2-k+1)-(-1+(-1)^(n^2 mod 3))*((n-1)^2 +k))/2, if n >k. %F A213928 As linear sequence %F A213928 a(n) = ((1+(-1)^(j^2 mod 3-1))*(j^2-i+1)-(-1+(-1)^(j^2 mod 3-1))*((j-1)^2 +i))/2, if j >= i; %F A213928 a(n) = ((1+(-1)^(i^2 mod 3))*(i^2-j+1)-(-1+(-1)^(i^2 mod 3))*((i-1)^2 +j))/2, if i >j; %F A213928 where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2). %e A213928 The start of the sequence as table. %e A213928 The direction of the placement denotes by ">" and "v". %e A213928 ..........v...........v...........v %e A213928 >1....4...5..16..25..26..49..64..65... %e A213928 >2....3...6..15..24..27..48..63..66... %e A213928 .9....8...7..14..23..28..47..62..67... %e A213928 >10..11..12..13..22..29..46..61..68... %e A213928 >17..18..19..20..21..30..45..60..69... %e A213928 .36..35..34..33..32..31..44..59..70... %e A213928 >37..38..39..40..41..42..43..58..71... %e A213928 >50..51..52..53..54..55..56..57..72... %e A213928 .81..80..79..78..77..76..75..74..73... %e A213928 . . . %e A213928 The start of the sequence as triangle array read by rows: %e A213928 1; %e A213928 4,2; %e A213928 5,3,9; %e A213928 16,6,8,10; %e A213928 25,15,7,11,17; %e A213928 26,24,14,12,18,36; %e A213928 49,27,23,13,19,35,37; %e A213928 64,48,28,22,20,34,38,50; %e A213928 65,63,47,29,21,33,39,51,81; %e A213928 . . . %o A213928 (Python) %o A213928 t=int((math.sqrt(8*n-7) - 1)/ 2) %o A213928 i=n-t*(t+1)/2 %o A213928 j=(t*t+3*t+4)/2-n %o A213928 if j>=i: %o A213928 result=((1+(-1)**(j**2%3-1))*(j**2-i+1)-(-1+(-1)**(j**2%3-1))*((j-1)**2 +i))/2 %o A213928 else: %o A213928 result=((1+(-1)**(i**2%3))*(i**2-j+1)-(-1+(-1)**(i**2%3))*((i-1)**2 +j))/2 %Y A213928 Cf. A219159, A081344, A194280, A042964, A130196, A011655, A220516. %K A213928 nonn,tabl %O A213928 1,2 %A A213928 _Boris Putievskiy_, Mar 06 2013