A140612 Integers k such that both k and k+1 are the sum of 2 squares.
0, 1, 4, 8, 9, 16, 17, 25, 36, 40, 49, 52, 64, 72, 73, 80, 81, 89, 97, 100, 116, 121, 136, 144, 145, 148, 169, 180, 193, 196, 225, 232, 233, 241, 244, 256, 260, 288, 289, 292, 305, 313, 324, 337, 360, 361, 369, 388, 400, 404, 409, 424, 441, 449, 457
Offset: 1
Examples
40 = 6^2 + 2^2, 41 = 5^2 + 4^2, so 40 is in the sequence.
Links
- David A. Corneth, Table of n, a(n) for n = 1..10000
Programs
-
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
-
Mathematica
(*M6*) A1 = {}; Do[If[SquaresR[2, n (n + 1)/2] > 0, AppendTo[A1, n]], {n, 0, 1500}]; A1 Join[{0}, Flatten[Position[Accumulate[Range[500]], ?(SquaresR[2, #]> 0&)]]] (* _Harvey P. Dale, Jun 07 2015 *) SequencePosition[Table[If[SquaresR[2,n]>0,1,0],{n,0,500}],{1,1}] [[All,1]]-1 (* Harvey P. Dale, Jul 28 2021 *)
-
Python
from itertools import count, islice, starmap from sympy import factorint def A140612_gen(startvalue=0): # generator of terms >= startvalue for k in count(max(startvalue,0)): if all(starmap(lambda d, e: e % 2 == 0 or d % 4 != 3, factorint(k*(k+1)).items())): yield k A140612_list = list(islice(A140612_gen(),20)) # Chai Wah Wu, Mar 07 2022
Extensions
a(1)=0 prepended and edited by Max Alekseyev, Oct 08 2019
Comments