fork download
  1. #!sapphire
  2.  
  3. def bernoulli(n)
  4. if(n=0)
  5. 1
  6. else
  7. -1/(n+1)*sum(0,n-1,fn(k)comb(n+1,k)*bernoulli(k));
  8.  
  9.  
  10. def comb(n,m)
  11. n!/(m!*(n-m)!);
  12.  
  13. def sum(s,e,f)
  14. if(s=e)
  15. f(s);
  16. else
  17. f(s)+sum(s+1,e,f);
  18.  
  19. norm> bernoulli(8);
  20. -1/30
  21. norm>
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#!sapphire
^
Main.java:1: error: class, interface, or enum expected
#!sapphire
  ^
Main.java:10: error: class, interface, or enum expected
def comb(n,m)
^
Main.java:13: error: class, interface, or enum expected
def sum(s,e,f)
^
Main.java:16: error: class, interface, or enum expected
  else
  ^
Main.java:19: error: class, interface, or enum expected
norm> bernoulli(8);
^
Main.java:20: error: class, interface, or enum expected
-1/30
^
7 errors
stdout
Standard output is empty