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.

A128549 Difference between triangular number and next perfect square.

This page as a plain text file.
%I A128549 #14 Jun 01 2024 12:07:28
%S A128549 3,1,3,6,1,4,8,13,4,9,15,3,9,16,1,8,16,25,6,15,25,3,13,24,36,10,22,35,
%T A128549 6,19,33,1,15,30,46,10,26,43,4,21,39,58,15,34,54,8,28,49,71,21,43,66,
%U A128549 13,36,60,4,28,53,79,19,45,72,9,36,64,93,26,55,85,15,45,76,3,34,66,99,22
%N A128549 Difference between triangular number and next perfect square.
%C A128549 If a(n)=1 then such n gives the sequence A006451 (triangular numbers whose distance to the nearest bigger perfect square is 1). [From _Ctibor O. Zizka_, Oct 07 2009]
%H A128549 Robert Israel, <a href="/A128549/b128549.txt">Table of n, a(n) for n = 1..10000</a>
%F A128549 a(n) = (floor(sqrt(n(n+1)/2))+1)^2-n(n+1)/2.
%e A128549 a(1)=2^2-1(1+1)/2=3, a(2)=2^2-2(2+1)/2=1, a(3)=3^2-3(3+1)/2=3, a(3)=4^2-4(4+1)/2=6.
%p A128549 f:= n -> (floor(sqrt(n*(n+1)/2))+1)^2-n*(n+1)/2:
%p A128549 map(f, [$1..100]); # _Robert Israel_, Jan 21 2020
%t A128549 Table[(Floor[Sqrt[n(n+1)/2]]+1)^2-n(n+1)/2,{n,100}]
%t A128549 (Floor[Sqrt[#]]+1)^2-#&/@Accumulate[Range[100]] (* _Harvey P. Dale_, Oct 15 2014 *)
%o A128549 (Python)
%o A128549 from math import isqrt
%o A128549 def A128549(n): return (isqrt(m:=n*(n+1)>>1)+1)**2-m # _Chai Wah Wu_, Jun 01 2024
%Y A128549 Cf. A000217, A000290, A006451.
%K A128549 nonn
%O A128549 1,1
%A A128549 _Zak Seidov_, May 08 2007