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.

A271439 If n is a triangular number, a(n) = 0, otherwise a(n) = n - A002024(n) + 1.

This page as a plain text file.
%I A271439 #25 Jun 02 2025 12:17:38
%S A271439 0,0,1,0,2,3,0,4,5,6,0,7,8,9,10,0,11,12,13,14,15,0,16,17,18,19,20,21,
%T A271439 0,22,23,24,25,26,27,28,0,29,30,31,32,33,34,35,36,0,37,38,39,40,41,42,
%U A271439 43,44,45,0,46,47,48,49,50,51,52,53,54,55,0,56,57,58
%N A271439 If n is a triangular number, a(n) = 0, otherwise a(n) = n - A002024(n) + 1.
%C A271439 a(n) gives the number above n when the natural numbers are represented as a square array, or 0 if n is in the top row.
%C A271439    1 3 6 10
%C A271439    2 5 9
%C A271439    4 8
%C A271439    7
%H A271439 Peter Kagey, <a href="/A271439/b271439.txt">Table of n, a(n) for n = 0..10000</a>
%e A271439 As a regular triangle, sequence begins:
%e A271439   0;
%e A271439   0, 1;
%e A271439   0, 2, 3;
%e A271439   0, 4, 5, 6;
%e A271439   0, 7, 8, 9, 10;
%e A271439   ...
%t A271439 Riffle[#, 0] &@ Map[# (# - 1)/2 + Range@ # &, Range[0, 11]] /. {} -> {0} // Flatten (* _Michael De Vlieger_, Apr 07 2016 *)
%o A271439 (Python)
%o A271439 from math import isqrt
%o A271439 def A271439(n): return n-m+(k<r) if (k:=n<<1)!=(r:=(m:=isqrt(k))*(m+1)) else 0 # _Chai Wah Wu_, Nov 07 2024
%Y A271439 Cf. A000217 (right diagonal), A006003 (row sums).
%K A271439 nonn,tabl
%O A271439 0,5
%A A271439 _Peter Kagey_, Apr 07 2016