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.

Showing 1-5 of 5 results.

A055096 Triangle read by rows, sums of 2 distinct nonzero squares: T(n,k) = k^2+n^2, (n>=2, 1 <= k <= n-1).

Original entry on oeis.org

5, 10, 13, 17, 20, 25, 26, 29, 34, 41, 37, 40, 45, 52, 61, 50, 53, 58, 65, 74, 85, 65, 68, 73, 80, 89, 100, 113, 82, 85, 90, 97, 106, 117, 130, 145, 101, 104, 109, 116, 125, 136, 149, 164, 181, 122, 125, 130, 137, 146, 157, 170, 185, 202, 221, 145, 148, 153, 160
Offset: 2

Views

Author

Antti Karttunen, Apr 04 2000

Keywords

Comments

Discovered by Bernard Frénicle de Bessy (1605?-1675). - Paul Curtz, Aug 18 2008
Terms that are not hypotenuses in primitive Pythagorean triangles, are replaced by 0 in A222946. - Reinhard Zumkeller, Mar 23 2013
This triangle T(n,k) gives the circumdiameters for the Pythagorean triangles with a = (n+1)^2 - k^2, b = 2*(n+1)*k and c = (n+1)^2 + k^2 (see the Floor van Lamoen entries or comments A063929, A063930, A002283, A003991). See also the formula section. Note that not all Pythagorean triangles are covered, e.g., (9,12,15) does not appear. - Wolfdieter Lang, Dec 03 2014

Examples

			The triangle T(n, k) begins:
n\k   1   2   3   4   5   6   7   8   9  10  11 ...
2:    5
3:   10  13
4:   17  20  25
5:   26  29  34  41
6:   37  40  45  52  61
7:   50  53  58  65  74  85
8:   65  68  73  80  89 100 113
9:   82  85  90  97 106 117 130 145
10: 101 104 109 116 125 136 149 164 181
11: 122 125 130 137 146 157 170 185 202 221
12: 145 148 153 160 169 180 193 208 225 244 265
...
13: 170 173 178 185 194 205 218 233 250 269 290 313,
14: 197 200 205 212 221 232 245 260 277 296 317 340 365,
15: 226 229 234 241 250 261 274 289 306 325 346 369 394 421,
16: 257 260 265 272 281 292 305 320 337 356 377 400 425 452 481,
...
Formatted and extended by _Wolfdieter Lang_, Dec 02 2014 (reformatted Jun 11 2015)
The successive terms are (1^2+2^2), (1^2+3^2), (2^2+3^2), (1^2+4^2), (2^2+4^2), (3^2+4^2), ...
		

Crossrefs

Sorting gives A024507. Count of divisors: A055097, Möbius: A055132. For trinv, follow A055088.
Cf. A001844 (right edge), A002522 (left edge), A033429 (central column).

Programs

  • Haskell
    a055096 n k = a055096_tabl !! (n-1) !! (k-1)
    a055096_row n = a055096_tabl !! (n-1)
    a055096_tabl = zipWith (zipWith (+)) a133819_tabl a140978_tabl
    -- Reinhard Zumkeller, Mar 23 2013
    
  • Magma
    [n^2+k^2: k in [1..n-1], n in [2..15]]; // G. C. Greubel, Apr 19 2023
    
  • Maple
    sum2distinct_squares_array := (n) -> (((n-((trinv(n-1)*(trinv(n-1)-1))/2))^2)+((trinv(n-1)+1)^2));
  • Mathematica
    T[n_, k_]:= (n+1)^2 + k^2; Table[T[n, k], {n,15}, {k,n}]//Flatten (* Jean-François Alcover, Mar 16 2015, after Reinhard Zumkeller *)
  • SageMath
    def A055096(n,k): return n^2 + k^2
    flatten([[A055096(n,k) for k in range(1,n)] for n in range(2,16)]) # G. C. Greubel, Apr 19 2023

Formula

a(n) = sum2distinct_squares_array(n).
T(n, 1) = A002522(n).
T(n, n-1) = A001844(n-1).
T(2*n-2, n-1) = A033429(n-1).
T(n,k) = A133819(n,k) + A140978(n,k) = (n+1)^2 + k^2, 1 <= k <= n. - Reinhard Zumkeller, Mar 23 2013
T(n, k) = a*b*c/(2*sqrt(s*(s-1)*(s-b)*(s-c))) with s =(a + b + c)/2 and the substitution a = (n+1)^2 - k^2, b = 2*(n+1)*k and c = (n+1)^2 + k^2 (the circumdiameter for the considered Pythagorean triangles). - Wolfdieter Lang, Dec 03 2014
From Bob Selcoe, Mar 21 2015: (Start)
T(n,k) = 1 + (n-k+1)^2 + Sum_{j=0..k-2} (4*j + 2*(n-k+3)).
T(n,k) = 1 + (n+k-1)^2 - Sum_{j=0..k-2} (2*(n+k-3) - 4*j).
Therefore: 4*(n-k+1) + Sum_{j=0..k-2} (2*(n-k+3) + 4*j) = 4*n(k-1) - Sum_{j=0..k-2} (2*(n+k-3) - 4*j). (End)
From G. C. Greubel, Apr 19 2023: (Start)
T(2*n-3, n-1) = A033429(n-1).
T(2*n-4, n-2) = A079273(n-1).
T(2*n-2, n) = A190816(n).
T(3*n-4, n-1) = 10*A000290(n-1) = A033583(n-1).
Sum_{k=1..n-1} T(n, k) = A331987(n-1).
Sum_{k=1..floor(n/2)} T(n-k, k) = A226141(n-1). (End)

Extensions

Edited: in T(n, k) formula by Reinhard Zumkeller k < n replaced by k <= n. - Wolfdieter Lang, Dec 02 2014
Made definition more precise, changed offset to 2. - N. J. A. Sloane, Mar 30 2015

A183134 Square array A(n,k) by antidiagonals. A(n,k) is the number of length 2n k-ary words (n,k>=0), either empty or beginning with the first character of the alphabet, that can be built by repeatedly inserting doublets into the initially empty word.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 3, 1, 0, 1, 1, 5, 10, 1, 0, 1, 1, 7, 29, 35, 1, 0, 1, 1, 9, 58, 181, 126, 1, 0, 1, 1, 11, 97, 523, 1181, 462, 1, 0, 1, 1, 13, 146, 1145, 4966, 7941, 1716, 1, 0, 1, 1, 15, 205, 2131, 14289, 48838, 54573, 6435, 1, 0
Offset: 0

Views

Author

Alois P. Heinz, Dec 26 2010

Keywords

Comments

Column k > 2 is asymptotic to 2^(2*n) * (k-1)^(n+1) / ((k-2)^2 * sqrt(Pi) * n^(3/2)). - Vaclav Kotesovec, Sep 07 2014

Examples

			A(3,2) = 10, because 10 words of length 6 beginning with the first character of the 2-letter alphabet {a, b} can be built by repeatedly inserting doublets (words with two equal letters) into the initially empty word: aaaaaa, aaaabb, aaabba, aabaab, aabbaa, aabbbb, abaaba, abbaaa, abbabb, abbbba.
Square array A(n,k) begins:
  1,  1,   1,    1,    1,     1,  ...
  0,  1,   1,    1,    1,     1,  ...
  0,  1,   3,    5,    7,     9,  ...
  0,  1,  10,   29,   58,    97,  ...
  0,  1,  35,  181,  523,  1145,  ...
  0,  1, 126, 1181, 4966, 14289,  ...
		

Crossrefs

Columns 0-10 give: A000007, A000012, A001700(n-1) for n>0, A194723, A194724, A194725, A194726, A194727, A194728, A194729, A194730.
Main diagonal gives A248828.
Coefficients of row polynomials for k>0 in k, (k+1) are given by A050166, A157491.

Programs

  • Maple
    A:= proc(n, k)
          local j;
          if n=0  then 1
        elif k<=1 then k
                  else add(binomial(2*n,j)*(n-j)*(k-1)^j, j=0..n-1)/n
          fi
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    a[n_, k_] := If[ n == 0, 1 , If[ k <= 1, k, Sum [Binomial[2*n, j]*(n-j)*(k-1)^j, {j, 0, n-1}] / n ] ]; Table[Table[a[n, d-n], {n, 0, d}], {d, 0, 10}] // Flatten (* Jean-François Alcover, Dec 09 2013, translated from Maple *)

Formula

A(n,k) = 1 if n=0, A(n,k) = k if n>0 and k<=1, and A(n,k) = 1/n * Sum_{j=0..n-1} C(2*n,j)*(n-j)*(k-1)^j else.
A(n,k) = A183135(n,k) if n=0 or k<2, A(n,k) = A183135(n,k)/k else.
G.f. of column k: 1/(1-k*x) if k<2, (1-1/k) * (1 + 2 / (k-2 + k * sqrt (1-(4*k-4)*x))) else.

A088307 Triangle, read by rows, T(n,k) = n^2 + k^2 if gcd(n,k)=1, otherwise 0.

Original entry on oeis.org

2, 5, 0, 10, 13, 0, 17, 0, 25, 0, 26, 29, 34, 41, 0, 37, 0, 0, 0, 61, 0, 50, 53, 58, 65, 74, 85, 0, 65, 0, 73, 0, 89, 0, 113, 0, 82, 85, 0, 97, 106, 0, 130, 145, 0, 101, 0, 109, 0, 0, 0, 149, 0, 181, 0, 122, 125, 130, 137, 146, 157, 170, 185, 202, 221, 0
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 05 2003

Keywords

Comments

(n^2-k^2, 2*k*n, T(n,k)) is a primitive Pythagorean triple iff T(n,k) > 0.

Examples

			Triangle begins:
   2;
   5,  0;
  10, 13,  0;
  17,  0, 25,  0;
  26, 29, 34, 41,  0;
  37,  0,  0,  0, 61, 0;
  ...
		

Crossrefs

Programs

  • Magma
    function A088307(n,k)
      if GCD(k,n) eq 1 then return n^2+k^2;
      else return 0;
      end if; return A088307;
    end function;
    [A088307(n,k): k in [1..n], n in [1..13]]; // G. C. Greubel, Dec 16 2022
    
  • Mathematica
    Table[If[CoprimeQ[n,k],n^2+k^2,0],{n,20},{k,n}]//Flatten (* Harvey P. Dale, Jul 13 2018 *)
  • SageMath
    def A088307(n,k):
        if (gcd(n,k)==1): return n^2 + k^2
        else: return 0
    flatten([[A088307(n,k) for k in range(1,n+1)] for n in range(1,14)]) # G. C. Greubel, Dec 16 2022

Formula

T(n, n) = 2*A000007(n-1).
T(n, 1) = A002522(n).
T(2*n+1, 2) = A078370(n).
Sum_{k=1..n} A057427(T(n,m)) = A000010(n).
From G. C. Greubel, Dec 15 2022: (Start)
T(n, n-1) = A001844(n).
T(n, n-2) = ((1-(-1)^n)/2) * A008527((n+1)/2).
T(2*n, n) = 5*A000007(n-1).
T(2*n+1, n) = A079273(n+1).
T(2*n-1, n) = A190816(n).
Sum_{k=1..floor((n+1)/2)} T(n-k+1, k) = A053818(n+1) + [n=1]. (End)

A192027 Square array read by antidiagonals: W(n,m) (n >= 1, m >= 1) is the Wiener index of the graph G(n,m) obtained from the n-circuit graph by adjoining m pendant edges at each node of the circuit.

Original entry on oeis.org

1, 10, 4, 27, 29, 9, 60, 75, 58, 16, 105, 160, 147, 97, 25, 174, 275, 308, 243, 146, 36, 259, 447, 525, 504, 363, 205, 49, 376, 658, 846, 855, 748, 507, 274, 64, 513, 944, 1239, 1371, 1265, 1040, 675, 353, 81, 690, 1278, 1768, 2002, 2022, 1755, 1380, 867, 442, 100
Offset: 1

Views

Author

Emeric Deutsch, Jun 26 2011

Keywords

Comments

W(1,m) = m^2 = A000290(m).
W(2,m) = A079273(m+1).
W(n,1) = A180574(n).

Examples

			a(3,1)=27 because in the graph with vertex set {A,B,C,A',B',C'} and edge set {AB, BC, CA, AA', BB', CC'} we have 6 pairs of vertices at distance 1 (the edges), 6 pairs at distance 2 (A'B, A'C, B'A, B'C, C'A, C'B) and 3 pairs at distance 3 (A'B', B'C', C'A'); 6*1 + 6*2 + 3*3 = 27.
The square array starts:
   1,   4,   9,  16,  25,   36,   49, ...;
  10,  29,  58,  97, 146,  205,  274, ...;
  27,  75, 147, 243, 363,  507,  675, ...;
  60, 160, 308, 504, 748, 1040, 1380, ...;
		

Crossrefs

Programs

  • Maple
    W := proc (n, m) if `mod`(n, 2) = 0 then (1/2)*n*((1/4)*n^2+2*m^2*n+(1/4)*m^2*n^2+2*m*n+(1/2)*m*n^2-2*m) else (1/8)*(n^2-1+m^2*n^2+8*m^2*n-m^2+2*m*n^2+8*m*n-10*m)*n end if end proc: for n to 10 do seq(W(n-i, i+1), i = 0 .. n-1) end do; # yields the antidiagonals in triangular form
    W := proc (n, m) if `mod`(n, 2) = 0 then (1/2)*n*((1/4)*n^2+2*m^2*n+(1/4)*m^2*n^2+2*m*n+(1/2)*m*n^2-2*m) else (1/8)*(n^2-1+m^2*n^2+8*m^2*n-m^2+2*m*n^2+8*m*n-10*m)*n end if end proc: for n to 10 do seq(W(n, m), m = 1 .. 10) end do; # yields the first 10 entries of each of rows 1,2,...,10.
    P := proc (n, m) if `mod`(n, 2) = 0 then sort(expand(n*(m*t+(1/2)*m*(m-1)*t^2)+n*(sum(t^j, j = 1 .. (1/2)*n-1))*(1+m*t)^2+(1/2)*n*t^((1/2)*n)*(1+m*t)^2)) else sort(expand(n*(m*t+(1/2)*m*(m-1)*t^2)+n*(sum(t^j, j = 1 .. (1/2)*n-1/2))*(1+m*t)^2)) end if end proc: P(4,9);

Formula

If n even, then: W(n,m) = n*(n^2/4 + 2*m^2*n + m^2*n^2/4 + 2*m*n + m*n^2/2 - 2*m)/2;
if n odd, then: W(n,m) = n*(n^2 - 1 + m^2*n^2 + 8*m^2*n - m^2 + 2*m*n^2 + 8*m*n - 10*m)/8.
The Wiener polynomial P(n,m;t) of the graph G(n,m) is given in the 3rd Maple program. It gives, for example, P(4,9) = 162*t^4 + 360*t^3 + 218*t^2 + 40*t. Its derivative, evaluated at t=1, yields the corresponding Wiener index W(4,9)=4184.

A192032 Square array read by antidiagonals: W(m,n) (m >= 0, n >= 0) is the Wiener index of the graph G(m,n) obtained in the following way: connect by an edge the center of an m-edge star with the center of an n-edge star. The Wiener index of a connected graph is the sum of distances between all unordered pairs of vertices in the graph.

Original entry on oeis.org

1, 4, 4, 9, 10, 9, 16, 18, 18, 16, 25, 28, 29, 28, 25, 36, 40, 42, 42, 40, 36, 49, 54, 57, 58, 57, 54, 49, 64, 70, 74, 76, 76, 74, 70, 64, 81, 88, 93, 96, 97, 96, 93, 88, 81, 100, 108, 114, 118, 120, 120, 118, 114, 108, 100, 121, 130, 137, 142, 145, 146, 145, 142, 137, 130, 121
Offset: 0

Views

Author

Emeric Deutsch, Jun 30 2011

Keywords

Comments

W(n,0) = W(0,n) = A000290(n+1) = (n+1)^2.
W(n,1) = W(1,n) = A028552(n+1) = (n+1)*(n+4).
W(n,2) = W(2,n) = A028881(n+4) = n^2 + 8*n + 9.
W(n,n) = A079273(n+1) = 5*n^2 + 4*n + 1.
W(n,m) = W(m,n) (trivially).

Examples

			W(1,2)=18 because in the graph with vertex set {A,a,B,b,b'} and edge set {AB, Aa, Bb, Bb'} we have 4 pairs of vertices at distance 1 (the edges), 4 pairs at distance 2 (Ab, Ab', Ba, bb') and 2 pairs at distance 3 (ab,ab'); 4*1 + 4*2 + 2*3 = 18.
The square array starts:
   1,  4,  9, 16, 25, ...;
   4, 10, 18, 28, 30, ...;
   9, 18, 29, 42, 57, ...;
  16, 28, 42, 58, 76, ...;
		

Crossrefs

Programs

  • Maple
    W := proc (m, n) options operator, arrow: m^2+n^2+3*m*n+2*m+2*n+1 end proc: for n from 0 to 10 do seq(W(n-i, i), i = 0 .. n) end do; # yields the antidiagonals in triangular form
    W := proc (m, n) options operator, arrow: m^2+n^2+3*m*n+2*m+2*n+1 end proc: for m from 0 to 9 do seq(W(m, n), n = 0 .. 9) end do; # yields the first 10 entries of each of rows 0,1,2,...,9

Formula

W(m,n) = m^2 + n^2 + 3*m*n + 2*m + 2*n + 1.
The Wiener polynomial of the graph G(n,m) is P(m,n;t) = (m+n+1)*t + (1/2)*(m^2 + n^2 + m + n)*t^2 + m*n*t^3.
Showing 1-5 of 5 results.