A070216 Triangle T(n, k) = n^2 + k^2, 1 <= k <= n, read by rows.
2, 5, 8, 10, 13, 18, 17, 20, 25, 32, 26, 29, 34, 41, 50, 37, 40, 45, 52, 61, 72, 50, 53, 58, 65, 74, 85, 98, 65, 68, 73, 80, 89, 100, 113, 128, 82, 85, 90, 97, 106, 117, 130, 145, 162, 101, 104, 109, 116, 125, 136, 149, 164, 181, 200, 122, 125, 130, 137, 146, 157
Offset: 1
Examples
a(3,2)=13 because 3^2+2^2=13. Triangle begins: 2; 5, 8; 10, 13, 18; 17, 20, 25, 32; 26, 29, 34, 41, 50; 37, 40, 45, 52, 61, 72; 50, 53, 58, 65, 74, 85, 98; 65, 68, 73, 80, 89, 100, 113, 128; 82, 85, 90, 97, 106, 117, 130, 145, 162; 101, 104, 109, 116, 125, 136, 149, 164, 181, 200; ... - _Vincenzo Librandi_, Apr 30 2014
Links
- Reinhard Zumkeller, Rows n = 1..120 of triangle, flattened
Crossrefs
Programs
-
Haskell
a070216 n k = a070216_tabl !! (n-1) !! (k-1) a070216_row n = a070216_tabl !! (n-1) a070216_tabl = zipWith (zipWith (\u v -> (u + v) `div` 2)) a215630_tabl a215631_tabl -- Reinhard Zumkeller, Nov 11 2012
-
Magma
[n^2+k^2: k in [1..n], n in [1..15]]; // Vincenzo Librandi, Apr 30 2014
-
Mathematica
t[n_,k_]:=n^2 + k^2; Table[t[n, k], {n, 11}, {k, n}]//Flatten (* Vincenzo Librandi, Apr 30 2014 *)
-
PARI
T(n, k) = n^2+k^2; for (n=1, 10, for(k=1, n, print1(T(n, k), ", "))) \\ Altug Alkan, Mar 24 2016
-
Python
from math import isqrt def A070216(n): a = (m:=isqrt(k:=n<<1))+(k>m*(m+1)) return (a*(a*(a*(a-2)-(m:=n<<2)+5)+m)>>2)+n**2 # Chai Wah Wu, Jun 20 2025
Formula
a(n, k) = n^2 + k^2, 1 <= k <= n.
Extensions
More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2002
Edited and corrected by M. F. Hasler, Apr 05 2016
Comments