/***********************************************************
eulerian.c -- Euler (オイラー) の数
***********************************************************/

Function Eulerian(n As Long,k As Long) As Long

If (k = 0) Then Eulerian = 1: Exit Function
If (k < 0 Or k >= n) Then Eulerian = 0: Exit Function

Eulerian = (k + 1) * Eulerian(n - 1, k) + (n - k) * Eulerian(n - 1, k - 1)
End Function

#N88BASIC

Dim n As Long,k As Long

Print " k";
For k=0 To 8: Print k;" "; : Next
Print ""
Print "n ";
For k=0 To 8: Print "------"; : Next
Print ""
For n=0 To 8
Print n;"| ";
For k=0 To 8: Print Eulerian(n, k);" "; : Next
Print ""
Next