login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A140612 Integers k such that both k and k+1 are the sum of 2 squares. 8

%I #26 Sep 08 2022 08:45:34

%S 0,1,4,8,9,16,17,25,36,40,49,52,64,72,73,80,81,89,97,100,116,121,136,

%T 144,145,148,169,180,193,196,225,232,233,241,244,256,260,288,289,292,

%U 305,313,324,337,360,361,369,388,400,404,409,424,441,449,457

%N Integers k such that both k and k+1 are the sum of 2 squares.

%C Equivalently, nonnegative k such that k*(k+1) is the sum of two squares.

%C 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 Trivially, sequence includes all positive squares.

%H David A. Corneth, <a href="/A140612/b140612.txt">Table of n, a(n) for n = 1..10000</a>

%e 40 = 6^2 + 2^2, 41 = 5^2 + 4^2, so 40 is in the sequence.

%t (*M6*) A1 = {}; Do[If[SquaresR[2, n (n + 1)/2] > 0, AppendTo[A1, n]], {n, 0, 1500}]; A1

%t Join[{0}, Flatten[Position[Accumulate[Range[500]], _?(SquaresR[2, #]> 0&)]]] (* _Harvey P. Dale_, Jun 07 2015 *)

%t SequencePosition[Table[If[SquaresR[2,n]>0,1,0],{n,0,500}],{1,1}] [[All,1]]-1 (* _Harvey P. Dale_, Jul 28 2021 *)

%o (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 (Python)

%o from itertools import count, islice, starmap

%o from sympy import factorint

%o def A140612_gen(startvalue=0): # generator of terms >= startvalue

%o for k in count(max(startvalue,0)):

%o if all(starmap(lambda d, e: e % 2 == 0 or d % 4 != 3, factorint(k*(k+1)).items())):

%o yield k

%o A140612_list = list(islice(A140612_gen(),20)) # _Chai Wah Wu_, Mar 07 2022

%Y Cf. A000217, A000290, A000404, A001481, A002378, A050795, A073613.

%K nonn,easy

%O 1,3

%A _Franklin T. Adams-Watters_, May 19 2008

%E a(1)=0 prepended and edited by _Max Alekseyev_, Oct 08 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 18:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)