login
Cumulative sums of the first ceiling(n/2)+1 elements of rows 0 to n in Pascal's triangle.
0

%I #12 Jan 22 2022 19:44:31

%S 1,3,6,13,24,50,92,191,354,736,1374,2860,5370,11182,21090,43909,83112,

%T 172958,328340,682862,1299528,2700820,5150688,10697070,20437756,

%U 42415272,81170004,168337168,322613196,668607412,1283037084,2657319103,5105342946,10567113352,20323851054

%N Cumulative sums of the first ceiling(n/2)+1 elements of rows 0 to n in Pascal's triangle.

%e The first ceiling(n/2)+1 elements from the first four rows of Pascal's are:

%e 1

%e 1 1

%e 1 2

%e 1 3 3

%e So a(0)=1, a(1)=a(0)+1+1=3, a(2)=a(1)+1+2=6, a(3)=a(2)+1+3+3=13.

%o (Python)

%o seq=[];prev=[];total=0

%o for n in range(30):

%o row=[1]

%o last=int(n/2)

%o for k in range(last):

%o row.append(prev[k]+prev[k+1])

%o if n%2==1:

%o row.append(row[-1])

%o prev=row

%o total+=sum(row)

%o seq.append(total)

%o print(seq)

%Y Cf. A007318, A116496 (for n>=2, first differences).

%K nonn,easy

%O 0,2

%A _J. Stauduhar_, Jan 18 2022