Triangular numbers: Difference between revisions

→‎{{header|ALGOL 68}}: Fixed the triangular root routine
(→‎{{header|ALGOL 68}}: Fixed the triangular root routine)
Line 124:
PROC long crt = ( LONG REAL x )LONG REAL: long exp( long ln( x ) / 3 );
# returns a LONG REAL approximation to the triangular root of x #
PROC real triangular root = ( LONG INT x )LONG REAL: ( long sqrt( ( 8 * x ) + 1 ) - 1 ) / 2;
# returns a LONG REAL approximation to the tetrahedral root of x #
PROC real tetrahedral root = ( LONG INT x )LONG REAL:
Line 209:
triangular: 6543 tetrahedral: 503.56183 pentatopic: 149.06095
Roots of 26728085384
triangular: 231205.4055640557 tetrahedral: 5432 pentatopic: 893.44246
Roots of 14545501785001
triangular: 5393607.1581 tetrahedral: 44355.77738 pentatopic: 4321
</pre>
 
=={{header|AppleScript}}==
 
3,021

edits