'********************************************************************* '* This program computes Euler number En using subroutine EULERA * '* ----------------------------------------------------------------- * '* SAMPLE RUN: * '* Compute Euler number En for n = 0,1,...,10. * '* * '* Please enter Nmax: 10 * '* * '* n En * '* ---------------------- * '* 0 1 * '* 2 -1 * '* 4 5 * '* 6 -61 * '* 8 1385 * '* 10 -50521 * '* ---------------------- * '* * '* ----------------------------------------------------------------- * '* REFERENCE: "Fortran Routines for Computation of Special Functions,* '* jin.ece.uiuc.edu/routines/routines.html". * '* * '* Basic Release By J-P Moreau, Paris. * '* (www.jpmoreau.fr) * '********************************************************************* ' PROGRAM MEULERA DEFDBL A-H, O-Z DEFINT I-N CLS PRINT INPUT " Please enter Nmax: ", N DIM EN(N) GOSUB 1000 'call EULERA(N,EN) PRINT PRINT " n En" PRINT " ----------------------" FOR K = 0 TO N STEP 2 PRINT USING "####"; K; : PRINT " "; EN(K) NEXT K PRINT " ----------------------" PRINT END 'of main program 1000 'Subroutine EULERA(N, EN) ' ====================================== ' Purpose: Compute Euler number En ' Input : N --- Serial number ' Output: EN(N) --- En ' ====================================== EN(0) = 1# FOR M = 1 TO N / 2 S = 1# FOR K = 1 TO M - 1 R = 1! FOR J = 1 TO 2 * K R = R * (2# * M - 2# * K + J) / J NEXT J S = S + R * EN(2 * K) NEXT K EN(2 * M) = -S NEXT M RETURN 'end of file meulera.bas