Faulhaber's triangle: Difference between revisions

Content added Content deleted
(→‎{{header|ALGOL 68}}: Tweak and andle the stretch goal)
imported>Maxima enthusiast
Line 2,329: Line 2,329:
else if k >= 2 and k <= n + 1 then (n/k) * faulhaber_fraction(n-1, k-1)
else if k >= 2 and k <= n + 1 then (n/k) * faulhaber_fraction(n-1, k-1)
else if k = 1 then 1 - sum(faulhaber_fraction(n, i), i, 2, n+1)
else if k = 1 then 1 - sum(faulhaber_fraction(n, i), i, 2, n+1)
else 0;
else 0$

faulhaber_row(n):=makelist(faulhaber_fraction(n,k),k,1,n+1);
faulhaber_row(n):=makelist(faulhaber_fraction(n,k),k,1,n+1)$
/* Example */
/* Example */
/* triangle_faulhaber_first_ten_rows:block(makelist(faulhaber_row(i),i,0,9),table_form(%%));
triangle_faulhaber_first_ten_rows:block(makelist(faulhaber_row(i),i,0,9),table_form(%%));
matrix(
[1, , , , , , , , , ],
[1/2, 1/2, , , , , , , , ],
[1/6, 1/2, 1/3, , , , , , , ],
[0, 1/4, 1/2, 1/4, , , , , , ],
[-1/30, 0, 1/3, 1/2, 1/5, , , , , ],
[0, -1/12, 0, 5/12, 1/2, 1/6, , , , ],
[1/42, 0, -1/6, 0, 1/2, 1/2, 1/7, , , ],
[0, 1/12, 0, -7/24, 0, 7/12, 1/2, 1/8, , ],
[-1/30, 0, 2/9, 0, -7/15, 0, 2/3, 1/2, 1/9, ],
[0, -3/20, 0, 1/2, 0, -7/10, 0, 3/4, 1/2, 1/10]
)
*/
</syntaxhighlight>
</syntaxhighlight>
[[File:Faulhaber.png|thumb|center]]


=={{header|Nim}}==
=={{header|Nim}}==