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.

A231354 Least k such that n - triangular(k) is a square, or -1 if no such k exists.

This page as a plain text file.
%I A231354 #11 Sep 22 2024 17:47:22
%S A231354 0,0,1,2,0,1,3,2,-1,0,1,4,2,-1,4,3,0,1,-1,2,-1,6,3,-1,5,0,1,-1,2,7,6,
%T A231354 3,7,-1,-1,4,0,1,-1,2,5,-1,3,-1,7,8,4,-1,-1,0,1,5,2,7,9,3,10,6,-1,4,
%U A231354 -1,8,-1,-1,0,1,11,2,-1,-1,3,10,8,-1,4,11,-1,7,12,5,10,0
%N A231354 Least k such that n - triangular(k) is a square, or -1 if no such k exists.
%C A231354 Indices of -1's: A014134.
%C A231354 Indices of 0's: A000290.
%C A231354 Indices of 1's: A002522.
%o A231354 (Python)
%o A231354 import math
%o A231354 for n in range(333):
%o A231354   for k in range(1000000):
%o A231354     t = n - k*(k+1)/2
%o A231354     if t<0:
%o A231354       print('-1', end=', ')
%o A231354       break
%o A231354     r = int(math.sqrt(t))
%o A231354     if r*r==t:
%o A231354       print(str(k), end=', ')
%o A231354       break
%Y A231354 Cf. A000217, A000290, A002522, A014134, A231353.
%K A231354 sign
%O A231354 0,4
%A A231354 _Alex Ratushnyak_, Nov 08 2013