Displaying 1-7 of 7 results found.
page
1
Number of addition triangles with apex n (version 2).
+10
8
1, 2, 2, 4, 4, 7, 7, 12, 12, 18, 19, 27, 28, 39, 41, 54, 58, 74, 78, 99, 106, 129, 139, 168, 179, 214, 229, 268, 289, 335, 357, 414, 443, 504, 540, 612, 653, 737, 786, 878, 938, 1045, 1111, 1234, 1313, 1444, 1539, 1692, 1795, 1965, 2082, 2273, 2414
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.
EXAMPLE
For n = 5:
5
2,3 5 5
1,1,2 4,1 2,3 5.
with four different bases, so a(5) = 4.
CROSSREFS
See A062684 for version 1 (counts reversals).
Equivalent sequences with restrictions on rows: A337765 (weakly increasing), A337766 (strongly increasing).
Equivalent sequence where n is the sum of all numbers in the triangle: A337787.
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.
+10
7
1, 1, 3, 5, 23, 61, 143, 215, 995, 2481, 5785, 12907, 29279, 64963, 144289, 158049, 683311, 1471123, 3166531, 6759177, 14404547, 30548713
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
EXAMPLE
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.
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 *)
PROG
(MATLAB)
for n=0:9
size(unique(perms(0:n)*diag(fliplr(pascal(n+1)))), 1)
(C++)
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
inline long long pascApx(const vector<int> & s)
{
const int n = s.size() ;
vector<long long> scp(n) ;
for(int i=0; i<n; i++)
scp[i] = s[i] ;
for(int i=1; i<n; i++)
for(int acc=0 ; acc < n-i ; acc++)
scp[acc] += scp[acc+1] ;
return scp[0] ;
}
int main(int argc, char *argv[])
{
for(int n=1 ; ; n++)
{
vector<int> s;
for(int i=0; i<n; i++)
s.push_back(i) ;
set<long long> apx;
do
{
apx.insert( pascApx(s)) ;
} while( next_permutation(s.begin(), s.end()) ) ;
cout << n << " " << apx.size() << endl ;
}
return 0 ;
(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
(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))
(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
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
Number of addition triangles with apex n where all rows are strongly increasing.
+10
5
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
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
EXAMPLE
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
PROG
(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
(1..n).map{|i| A(i)}
end
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).
Number of addition triangles with apex n where all rows are weakly increasing.
+10
4
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
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
EXAMPLE
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
PROG
(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
(1..n).map{|i| A(i)}
end
Number of addition triangles whose sum is n (version 2).
+10
3
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
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.
EXAMPLE
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
PROG
(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
(1..n).map{|i| A(i)}
end
Number of addition triangles whose sum is n (version 1).
+10
2
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
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.
EXAMPLE
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
PROG
(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
(1..n).map{|i| A(i)}
end
The number of maximally large absolute-difference triangles consisting of positive integers <= n.
+10
1
1, 2, 4, 8, 16, 32, 44, 72, 128, 220, 380, 620, 1232, 2400, 3988, 7008, 14260, 25512, 50944, 105560, 197880, 381432, 785984, 1443992, 2981200, 6623144, 13044340, 26020924, 55781760, 108592260, 231819360, 526660160, 1071224176, 2231977656, 4950184948, 10009562624
COMMENTS
a(17) is the first term that is more than twice its predecessor.
All terms after a(2) are divisible by four. This is because valid starting layers (of length greater than two) produce distinct valid starting layers when subjected to either or both of two transformations.
.
1 1
2 1 1 2
1 3 2 2 3 1
* | *
* | *
* | *
------|------
* | *
* | *
* | *
3 1 2 2 1 3
2 1 1 2
1 1
.
There is the obvious reflection about the y-axis (reversal), and there is the somewhat less obvious reflection about the x-axis. Reflection about the x-axis is valid because absolute differences are maintained. Note that it is not possible for a solution to be equivalent to any of its own transformations. If it were, the base layer or the layer that succeeds it would need to be palindromic. This is invalid because any absolute-difference triangle with a palindromic base and a height greater than one is topped with a zero.
EXAMPLE
a(5) = 16
.
1 2 5 1 2 3 2 5 1 2 3 4 1 5 4 5 4 1 5 4
1 3 4 1 1 3 4 1 1 3 4 1 1 3 4 1
2 1 3 2 1 3 2 1 3 2 1 3
1 2 1 2 1 2 1 2
1 1 1 1
.
3 1 5 4 2 3 5 1 2 4 1 4 5 1 4 5 2 1 5 2
2 4 1 2 2 4 1 2 3 1 4 3 3 1 4 3
2 3 1 2 3 1 2 3 1 2 3 1
1 2 1 2 1 2 1 2
1 1 1 1
.
2 4 5 1 3 4 2 1 5 3 2 5 1 2 5 4 1 5 4 1
2 1 4 2 2 1 4 2 3 4 1 3 3 4 1 3
1 3 2 1 3 2 1 3 2 1 3 2
2 1 2 1 2 1 2 1
1 1 1 1
.
2 1 5 2 1 2 1 5 2 3 4 5 1 4 3 4 5 1 4 5
1 4 3 1 1 4 3 1 1 4 3 1 1 4 3 1
3 1 2 3 1 2 3 1 2 3 1 2
2 1 2 1 2 1 2 1
1 1 1 1
.
PROG
(Python and C) See Links section.
Search completed in 0.013 seconds
|