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-7 of 7 results.

A062684 Number of addition triangles with apex n (version 1).

Original entry on oeis.org

1, 2, 3, 5, 7, 10, 13, 18, 23, 29, 37, 46, 55, 68, 81, 96, 115, 135, 155, 183, 211, 241, 277, 317, 357, 407, 457, 513, 577, 645, 713, 799, 885, 977, 1079, 1191, 1305, 1438, 1571, 1717, 1875, 2048, 2221, 2423, 2625, 2840, 3077, 3333, 3589, 3876, 4163
Offset: 1

Views

Author

Naohiro Nomoto, Feb 11 2002

Keywords

Comments

An addition triangle has any set of positive numbers as base; other rows are formed by adding pairs of adjacent numbers.
Reversing the base counts as a different triangle.

Examples

			For n = 5:
    5       5
   2,3     3,2     5     5     5     5
  1,1,2   2,1,1   4,1   1,4   2,3   3,2   5
with seven different bases, so a(5) = 7.
		

Crossrefs

Cf. A028307, A066411, see A062896 for version 2.

Extensions

Extended and edited by John W. Layman, Feb 14 2002

A066411 Form a triangle with the numbers [0..n] on the base, where each number is the sum of the two below; a(n) is the number of different possible values for the apex.

Original entry on oeis.org

1, 1, 3, 5, 23, 61, 143, 215, 995, 2481, 5785, 12907, 29279, 64963, 144289, 158049, 683311, 1471123, 3166531, 6759177, 14404547, 30548713
Offset: 0

Views

Author

Naohiro Nomoto, Dec 25 2001

Keywords

Comments

a(n) is the number of different possible sums of c_k * (n choose k) where the c_k are a permutation of 0 through n. - Joshua Zucker, May 08 2006

Examples

			For n = 2 we have three triangles:
..4.......5.......3
.1,3.....2,3.....2,1
0,1,2...0,2,1...2,0,1
with three different values for the apex, so a(2) = 3.
		

Crossrefs

Cf. A062684, A062896, A099325, A189162, A189390 (maximum apex value), A189391 (minimum apex value).

Programs

  • Haskell
    import Data.List (permutations, nub)
    a066411 0 = 1
    a066411 n = length $ nub $ map
       apex [perm | perm <- permutations [0..n], head perm < last perm] where
       apex = head . until ((== 1) . length)
                           (\xs -> (zipWith (+) xs $ tail xs))
    -- Reinhard Zumkeller, Jan 24 2012
    
  • MATLAB
    for n=0:9
    size(unique(perms(0:n)*diag(fliplr(pascal(n+1)))),1)
    end % Nathaniel Johnston, Apr 20 2011
    (C++)
    #include 
    #include 
    #include 
    #include 
    using namespace std;
    inline long long pascApx(const vector & s)
    {
        const int n = s.size() ;
        vector scp(n) ;
        for(int i=0; i s;
            for(int i=0;i apx;
            do
            {
                apx.insert( pascApx(s)) ;
            } while( next_permutation(s.begin(),s.end()) ) ;
            cout << n << " " << apx.size() << endl ;
        }
        return 0 ;
    } /* R. J. Mathar, Jan 24 2012 */
    
  • Mathematica
    g[s_List] := Plus @@@ Partition[s, 2, 1]; f[n_] := Block[{k = 1, lmt = 1 + (n + 1)!, lst = {}, p = Permutations[Range[0, n]]}, While[k < lmt, AppendTo[ lst, Nest[g, p[[k]], n][[1]]]; k++]; lst]; Table[ Length@ Union@ f@ n, {n, 0, 10}] (* Robert G. Wilson v, Jan 24 2012 *)
  • PARI
    A066411(n)={my(u=0,o=A189391(n),v,b=vector(n++,i,binomial(n-1,i-1))~);sum(k=1,n!\2,!bittest(u,numtoperm(n,k)*b-o) & u+=1<<(numtoperm(n,k)*b-o))}  \\ M. F. Hasler, Jan 24 2012
    
  • Python
    from sympy import binomial
    def partitionpairs(xlist): # generator of all partitions into pairs and at most 1 singleton, returning the sums of the pairs
        if len(xlist) <= 2:
            yield [sum(xlist)]
        else:
            m = len(xlist)
            for i in range(m-1):
                for j in range(i+1,m):
                    rem = xlist[:i]+xlist[i+1:j]+xlist[j+1:]
                    y = [xlist[i]+xlist[j]]
                    for d in partitionpairs(rem):
                        yield y+d
    def A066411(n):
        b = [binomial(n,k) for k in range(n//2+1)]
        return len(set((sum(d[i]*b[i] for i in range(n//2+1)) for d in partitionpairs(list(range(n+1)))))) # Chai Wah Wu, Oct 19 2021

Extensions

More terms from John W. Layman, Jan 07 2003
a(10) from Nathaniel Johnston, Apr 20 2011
a(11) from Alois P. Heinz, Apr 21 2011
a(12) and a(13) from Joerg Arndt, Apr 21 2011
a(14)-a(15) from Alois P. Heinz, Apr 27 2011
a(0)-a(15) verified by R. H. Hardin Jan 27 2012
a(16) from Alois P. Heinz, Jan 28 2012
a(17)-a(21) from Graeme McRae, Jan 28, Feb 01 2012

A028307 Form a triangle with n numbers in top row; all other numbers are the sum of their parents. E.g.: 4 1 2 7; 5 3 9; 8 12; 20. The numbers must be positive and distinct and the final number is to be minimized. Sequence gives final number.

Original entry on oeis.org

1, 3, 8, 20, 43, 98, 212, 465, 1000, 2144, 4497, 9504, 19872, 41455, 85356, 178630, 363467, 757085, 1541998, 3183600, 6515066, 13357593, 27432649, 55914902, 114683858, 233517515, 478061719, 972479046, 1986013932
Offset: 1

Views

Author

Keywords

Comments

Suggested by Problem 401 of the All-Soviet-Union Mathematical Competitions 1961-1986. Two different links are available for this collection.

Examples

			Solutions for n = 1, 2, ... are:
  1;
  1, 2;
  2, 1, 4;
  4, 1, 2, 7;
  7, 2, 1, 4, 6;
  8, 6, 1, 3, 2, 10;
  ...
		

Crossrefs

Formula

From A.H.M. Smeets, Feb 25 2022: (Start)
a(n) > 2*a(n-1). Proof: Let x, y be the numbers in the second last row, then x >= a(n-1), y >= a(n-1) and x != y, so a(n) = x + y > 2*a(n-1).
It seems that a(n) > (4/3)*(2*a(n-1)-a(n-2)). (End)

Extensions

More terms from the author, Jul 03 2001

A337766 Number of addition triangles with apex n where all rows are strongly increasing.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 4, 5, 6, 6, 8, 9, 10, 11, 13, 14, 16, 17, 19, 22, 24, 25, 28, 31, 33, 35, 39, 43, 46, 48, 52, 57, 60, 63, 69, 75, 78, 82, 88, 94, 99, 104, 111, 119, 124, 129, 137, 147, 153, 160, 169, 179, 187, 194, 204, 216, 224, 233, 246, 259, 267, 277, 292, 308, 318, 329, 343, 361
Offset: 1

Views

Author

Seiichi Manyama, Sep 19 2020

Keywords

Comments

An addition triangle has any finite sequence of positive numbers as base; other rows are formed by adding pairs of adjacent numbers.
If the bottom row is strongly increasing, then every row is strongly increasing.
8
3<5
1<2<3

Examples

			For n = 5:
   5     5
  1,4   2,3   5
For n = 6:
   6     6
  1,5   2,4   6
For n = 7:
   7     7     7
  1,6   2,5   3,4   7
For n = 8:
    8
   3,5     8     8     8
  1,2,3   1,7   2,6   3,5   8
For n = 9:
    9
   3,6     9     9     9     9
  1,2,4   1,8   2,7   3,6   4,5   9
		

Crossrefs

Equivalent sequences with different restrictions on rows: A062684 (none, except terms are positive), A062896 (not a reversal of a counted row), A337765 (weakly increasing).
Cf. A346523.

Programs

  • Ruby
    def A(n)
      f_ary = [[n]]
      cnt = 1
      while f_ary.size > 0
        b_ary = []
        f_ary.each{|i|
          s = i.size
          (1..i[0] - 1).each{|j|
            a = [j]
            (0..s - 1).each{|k|
              num = i[k] - a[k]
              if num > 0
                a << num
              else
                break
              end
            }
            b_ary << a if a.size == s + 1 && a == a.uniq.sort
          }
        }
        f_ary = b_ary
        cnt += f_ary.size
      end
      cnt
    end
    def A337766(n)
      (1..n).map{|i| A(i)}
    end
    p A337766(50)

A337765 Number of addition triangles with apex n where all rows are weakly increasing.

Original entry on oeis.org

1, 2, 2, 4, 4, 5, 6, 9, 9, 11, 12, 15, 16, 18, 20, 26, 27, 29, 32, 37, 39, 43, 47, 53, 55, 60, 65, 72, 75, 80, 88, 99, 102, 108, 114, 125, 132, 141, 148, 159, 166, 176, 187, 200, 206, 218, 232, 249, 257, 268, 282, 301, 313, 327, 340, 360, 374, 393, 410, 429, 444, 465, 487, 516, 530, 550
Offset: 1

Views

Author

Seiichi Manyama, Sep 19 2020

Keywords

Comments

An addition triangle has any set of positive numbers as base; other rows are formed by adding pairs of adjacent numbers.
If the bottom row are weakly increasing, then every rows are weakly increasing.
5
2<=3
1<=1<=2

Examples

			For n = 5:
    5
   2,3     5     5
  1,1,2   1,4   2,3   5
For n = 6:
    6
   2,4     6     6     6
  1,1,3   1,5   2,4   3,3   6
For n = 7:
    7       7
   2,5     3,4     7     7     7
  1,1,4   1,2,2   1,6   2,5   3,4   7
For n = 8:
     8
    4,4       8       8       8
   2,2,2,    2,6     3,5     4,4     8     8     8     8
  1,1,1,1   1,1,5   1,2,3   2,2,2   1,7   2,6   3,5   4,4   8
For n = 9:
     9
    4,5       9       9       9
   2,2,3,    2,7     3,6     4,5     9     9     9     9
  1,1,1,2   1,1,6   1,2,4   2,2,3   1,8   2,7   3,6   4,5   9
		

Crossrefs

Programs

  • Ruby
    def A(n)
      f_ary = [[n]]
      cnt = 1
      while f_ary.size > 0
        b_ary = []
        f_ary.each{|i|
          s = i.size
          (1..i[0] - 1).each{|j|
            a = [j]
            (0..s - 1).each{|k|
              num = i[k] - a[k]
              if num > 0
                a << num
              else
                break
              end
            }
            b_ary << a if a.size == s + 1 && a == a.sort
          }
        }
        f_ary = b_ary
        cnt += f_ary.size
      end
      cnt
    end
    def A337765(n)
      (1..n).map{|i| A(i)}
    end
    p A337765(50)

A337787 Number of addition triangles whose sum is n (version 2).

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 2, 4, 1, 5, 1, 6, 3, 5, 2, 8, 2, 8, 4, 8, 3, 12, 3, 11, 6, 11, 5, 15, 4, 16, 9, 14, 7, 20, 8, 18, 11, 20, 12, 25, 8, 25, 18, 24, 12, 31, 16, 32, 19, 29, 21, 39, 19, 36, 28, 38, 25, 47, 25, 46, 33, 46, 34, 55, 31, 56, 44, 55, 39, 67, 42, 66, 52, 66, 53, 76, 50, 81, 65, 77, 57
Offset: 1

Views

Author

Seiichi Manyama, Sep 21 2020

Keywords

Comments

An addition triangle has any set of positive numbers as base; other rows are formed by adding pairs of adjacent numbers.
Reversing the base does not count as a different triangle.

Examples

			   n |
-----+-------------------------------
   1 |  1
-----+-------------------------------
   2 |  2
-----+-------------------------------
   3 |  3
-----+-------------------------------
   4 |      2
     |  4  1,1
-----+-------------------------------
   5 |  5
-----+-------------------------------
   6 |      3
     |  6  1,2
-----+-------------------------------
   7 |  7
-----+-------------------------------
   8 |      4    4
     |  8  1,3  2,2
-----+-------------------------------
   9 |  9
-----+-------------------------------
  10 |      5    5
     | 10  1,4  2,3
-----+-------------------------------
  11 |       4
     |      2,2
     | 11  1,1,1
-----+-------------------------------
  12 |      6    6    6
     | 12  1,5  2,4  3,3
-----+-------------------------------
  13 | 13
-----+-------------------------------
  14 |                      5
     |      7    7    7    2,3
     | 14  1,6  2,5  3,4  1,1,2
-----+-------------------------------
  15 | 15
-----+-------------------------------
  16 |                           6
     |      8    8    8    8    3,3
     | 16  1,7  2,6  3,5  4,4  1,2,1
-----+-------------------------------
  17 |       6      6
     |      2,4    3,3
     | 17  1,1,3  2,1,2
-----+-------------------------------
  18 |      9    9    9    9
     | 18  1,8  2,7  3,6  4,5
-----+-------------------------------
  19 |       7
     |      3,4
     | 19  1,2,2
		

Crossrefs

Cf. A014430, A062684, A062896, see A337785 for version 1.

Programs

  • Ruby
    def f(n)
      ary = [1]
      (n - 1).times{|i|
        ary = [0] + ary + [0]
        ary = (0..i + 1).map{|j| ary[j] + ary[j + 1] + 1}
      }
      ary
    end
    def A(n)
      f_ary = (1..n / 2).map{|i| [i]}
      cnt = 2
      s = 1
      while f_ary.size > 0
        s_ary = f(s + 1)
        b_ary = []
        f_ary.each{|i|
          (1..i[0] - 1).each{|j|
            a = [j]
            (0..s - 1).each{|k|
              num = i[k] - a[k]
              if num > 0
                a << num
              else
                break
              end
            }
            if a.size == s + 1
              sum = (0..s).inject(0){|t, m| t + s_ary[m] * a[m]}
              if sum < n
                b_ary << a
              elsif sum == n
                cnt += 1
                cnt += 1 if a == a.reverse
              end
            end
          }
        }
        f_ary = b_ary
        s += 1
      end
      cnt / 2
    end
    def A337787(n)
      (1..n).map{|i| A(i)}
    end
    p A337787(50)

A337785 Number of addition triangles whose sum is n (version 1).

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 2, 6, 1, 9, 1, 9, 4, 9, 3, 14, 2, 14, 6, 14, 5, 21, 4, 19, 10, 21, 8, 27, 6, 29, 16, 25, 12, 38, 14, 33, 19, 37, 22, 46, 14, 47, 33, 45, 22, 59, 29, 59, 35, 56, 40, 74, 34, 68, 53, 72, 47, 90, 47, 88, 63, 88, 64, 105, 59, 108, 84, 106, 75, 130, 81, 125, 99, 128, 103, 147
Offset: 1

Views

Author

Seiichi Manyama, Sep 21 2020

Keywords

Comments

An addition triangle has any set of positive numbers as base; other rows are formed by adding pairs of adjacent numbers.
Reversing the base counts as a different triangle.

Examples

			   n |
-----+------------------------------------------------
   1 |  1
-----+------------------------------------------------
   2 |  2
-----+------------------------------------------------
   3 |  3
-----+------------------------------------------------
   4 |      2
     |  4  1,1
-----+------------------------------------------------
   5 |  5
-----+------------------------------------------------
   6 |      3    3
     |  6  1,2  2,1
-----+------------------------------------------------
   7 |  7
-----+------------------------------------------------
   8 |      4    4    4
     |  8  1,3  2,2  3,1
-----+------------------------------------------------
   9 |  9
-----+------------------------------------------------
  10 |      5    5    5    5
     | 10  1,4  2,3  3,2  4,1
-----+------------------------------------------------
  11 |       4
     |      2,2
     | 11  1,1,1
-----+------------------------------------------------
  12 |      6    6    6    6    6
     | 12  1,5  2,4  3,3  4,2  5,1
-----+------------------------------------------------
  13 | 13
-----+------------------------------------------------
  14 |                                     5      5
     |      7    7    7    7    7    7    2,3    3,2
     | 14  1,6  2,5  3,4  4,3  5,2  6,1  1,1,2  2,1,1
		

Crossrefs

Cf. A014430, A062684, A062896, A337765, A337766, see A337787 for version 2.

Programs

  • Ruby
    def f(n)
      ary = [1]
      (n - 1).times{|i|
        ary = [0] + ary + [0]
        ary = (0..i + 1).map{|j| ary[j] + ary[j + 1] + 1}
      }
      ary
    end
    def A(n)
      f_ary = (1..n / 2).map{|i| [i]}
      cnt = 1
      s = 1
      while f_ary.size > 0
        s_ary = f(s + 1)
        b_ary = []
        f_ary.each{|i|
          (1..i[0] - 1).each{|j|
            a = [j]
            (0..s - 1).each{|k|
              num = i[k] - a[k]
              if num > 0
                a << num
              else
                break
              end
            }
            if a.size == s + 1
              sum = (0..s).inject(0){|t, m| t + s_ary[m] * a[m]}
              if sum < n
                b_ary << a
              elsif sum == n
                cnt += 1
              end
            end
          }
        }
        f_ary = b_ary
        s += 1
      end
      cnt
    end
    def A337785(n)
      (1..n).map{|i| A(i)}
    end
    p A337785(50)
Showing 1-7 of 7 results.