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 A140612 #26 Sep 08 2022 08:45:34 %S A140612 0,1,4,8,9,16,17,25,36,40,49,52,64,72,73,80,81,89,97,100,116,121,136, %T A140612 144,145,148,169,180,193,196,225,232,233,241,244,256,260,288,289,292, %U A140612 305,313,324,337,360,361,369,388,400,404,409,424,441,449,457 %N A140612 Integers k such that both k and k+1 are the sum of 2 squares. %C A140612 Equivalently, nonnegative k such that k*(k+1) is the sum of two squares. %C A140612 Also, nonnegative k such that k*(k+1)/2 is the sum of two squares. This follows easily from the "sum of two squares theorem": x is the sum of two (nonnegative) squares iff its prime factorization does not contain p^e where p == 3 (mod 4) and e is odd. - _Robert Israel_, Mar 26 2018 %C A140612 Trivially, sequence includes all positive squares. %H A140612 David A. Corneth, <a href="/A140612/b140612.txt">Table of n, a(n) for n = 1..10000</a> %e A140612 40 = 6^2 + 2^2, 41 = 5^2 + 4^2, so 40 is in the sequence. %t A140612 (*M6*) A1 = {}; Do[If[SquaresR[2, n (n + 1)/2] > 0, AppendTo[A1, n]], {n, 0, 1500}]; A1 %t A140612 Join[{0}, Flatten[Position[Accumulate[Range[500]], _?(SquaresR[2, #]> 0&)]]] (* _Harvey P. Dale_, Jun 07 2015 *) %t A140612 SequencePosition[Table[If[SquaresR[2,n]>0,1,0],{n,0,500}],{1,1}] [[All,1]]-1 (* _Harvey P. Dale_, Jul 28 2021 *) %o A140612 (Magma) [k:k in [0..460]| forall{k+a: a in [0,1]|NormEquation(1, k+a) eq true}]; // _Marius A. Burtea_, Oct 08 2019 %o A140612 (Python) %o A140612 from itertools import count, islice, starmap %o A140612 from sympy import factorint %o A140612 def A140612_gen(startvalue=0): # generator of terms >= startvalue %o A140612 for k in count(max(startvalue,0)): %o A140612 if all(starmap(lambda d, e: e % 2 == 0 or d % 4 != 3, factorint(k*(k+1)).items())): %o A140612 yield k %o A140612 A140612_list = list(islice(A140612_gen(),20)) # _Chai Wah Wu_, Mar 07 2022 %Y A140612 Cf. A000217, A000290, A000404, A001481, A002378, A050795, A073613. %K A140612 nonn,easy %O A140612 1,3 %A A140612 _Franklin T. Adams-Watters_, May 19 2008 %E A140612 a(1)=0 prepended and edited by _Max Alekseyev_, Oct 08 2019