Skip to main content

Fast Computation of Bernoulli, Tangent and Secant Numbers

  • Conference paper
  • First Online:
Computational and Analytical Mathematics

Part of the book series: Springer Proceedings in Mathematics & Statistics ((PROMS,volume 50))

Abstract

We consider the computation of Bernoulli, Tangent (zag), and Secant (zig or Euler) numbers. In particular, we give asymptotically fast algorithms for computing the first n such numbers O(n 2(logn)2 + o(1)). We also give very short in-place algorithms for computing the first n Tangent or Secant numbers in O(n 2) integer operations. These algorithms are extremely simple and fast for moderate values of n. They are faster and use less space than the algorithms of Atkinson (for Tangent and Secant numbers) and Akiyama and Tanigawa (for Bernoulli numbers).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 129.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 169.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 169.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Abramowitz, M., Stegun, I.A.: Handbook of Mathematical Functions. Dover (1973)

    Google Scholar 

  2. Atkinson, M.D.: How to compute the series expansions of sec x and tan x. Am. Math. Monthly 93, 387–389 (1986)

    Article  MATH  Google Scholar 

  3. Bailey, D.H., Borwein, J.M., Crandall, R.E.: On the Khintchine constant. Math. Comput. 66, 417–431 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  4. Borwein, J.M., Corless, R.M.: Emerging tools for experimental mathematics. Am. Math. Mon. 106, 899–909 (1999)

    MathSciNet  Google Scholar 

  5. Bosma, W., Cannon, J., Playoust, C.: The Magma algebra system. I: the user language. J. Symbolic Comput. 24, 235–265 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  6. Brent, R.P.: Unrestricted algorithms for elementary and special functions. Information Processing, vol. 80, pp. 613–619. North-Holland, Amsterdam (1980). arXiv:1004.3621v1

    Google Scholar 

  7. Brent, R.P., Zimmermann, P.: Modern Computer Arithmetic. Cambridge University Press, Cambridge (2010). arXiv:1004.4710v1

    Google Scholar 

  8. Buhler, J., Crandall, R., Sompolski, R.: Irregular primes to one million. Math. Comput. 59, 717–722 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  9. Buhler, J., Crandall, R., Ernvall, R., Metsänkylä, T.: Irregular primes to four million. Math. Comput. 61, 151–153 (1993)

    Article  MATH  Google Scholar 

  10. Buhler, J., Crandall, R., Ernvall, R., Metsänkylä, T., Shokrollahi, M.A.: Irregular primes and cyclotomic invariants to twelve million. J. Symbolic Comput. 31, 89–96 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  11. Buhler, J., Harvey, D.: Irregular primes to 163 million. Math. Comput. 80, 2435–2444 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  12. Clausen, T.: Theorem. Astron. Nachr. 17, 351–352 (1840)

    Google Scholar 

  13. Crandall, R.E.: Topics in Advanced Scientific Computation. Springer, New York (1996)

    Book  MATH  Google Scholar 

  14. Crandall, R.E., Pomerance, C.: Prime Numbers: A Computational Perspective. Springer, New York (2001)

    Book  Google Scholar 

  15. Dilcher, K., Slavutskii, I.Sh.: A Bibliography of Bernoulli Numbers (last updated March 3, 2007). http://www.mscs.dal.ca/%7Edilcher/bernoulli.html.

  16. Ferguson, H.R.P., Bailey, D.H., Arno, S.: Analysis of PSLQ, an integer relation finding algorithm. Math. Comput. 68, 351–369 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  17. Fürer, M.: Faster integer multiplication. Proceedings of 39th Annual ACM Symposium on Theory of Computing (STOC), pp. 57–66. ACM, San Diego (2007)

    Google Scholar 

  18. Graham, R.L., Knuth, D.E., Patashnik, O.: Concrete Mathematics, 3rd edn. Addison-Wesley, Reading (1994)

    MATH  Google Scholar 

  19. Hare, K.: Multisectioning, rational poly-exponential functions and parallel computation. M.Sc. thesis, Department of Mathematics and Statistics, Simon Fraser University, Canada (2002)

    Google Scholar 

  20. Harvey, D.: A multimodular algorithm for computing Bernoulli numbers. Math. Comput. 79, 2361–2370 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  21. Kaneko, M.: The Akiyama–Tanigawa algorithm for Bernoulli numbers. J. Integer Seq. 3, Article 00.2.9, 6 (2000). http://www.cs.uwaterloo.ca/journals/JIS/

  22. Knuth, D.E.: Euler’s constant to 1271 places. Math. Comput. 16, 275–281 (1962)

    MathSciNet  MATH  Google Scholar 

  23. Knuth, D.E., Buckholtz, T.J.: Computation of Tangent, Euler, and Bernoulli numbers. Math. Comput. 21, 663–688 (1967)

    Article  MathSciNet  MATH  Google Scholar 

  24. Kung, H.T.: On computing reciprocals of power series. Numer. Math. 22, 341–348 (1974)

    Article  MathSciNet  MATH  Google Scholar 

  25. Schönhage, A., Strassen, V.: Schnelle Multiplikation großer Zahlen. Computing 7, 281–292 (1971)

    Article  MATH  Google Scholar 

  26. Sieveking, M.: An algorithm for division of power series. Computing 10, 153–156 (1972)

    Article  MathSciNet  MATH  Google Scholar 

  27. Sloane, N.J.A.: The on-line encyclopedia of integer sequences. http://oeis.org

  28. Von Staudt, K.G.C.: Beweis eines Lehrsatzes, die Bernoullischen Zahlen betreffend. J. Reine Angew. Math. 21, 372–374 (1840). http://gdz.sub.uni-goettingen.de

  29. Steel, A.: Reduce everything to multiplication. Presented at Computing by the Numbers: Algorithms, Precision and Complexity. Workshop for Richard Brent’s 60th Birthday, Berlin, 2006. http://www.mathematik.hu-berlin.de/%7Egaggle/EVENTS/2006/BRENT60/

  30. Stein, W. et al.: Sage. http://www.sagemath.org/

  31. Titchmarsh, E.C.: The Theory of the Riemann Zeta-Function, 2nd edn (revised by D. R. Heath-Brown). Clarendon Press, Oxford (1986)

    Google Scholar 

Download references

Acknowledgements

We thank Jon Borwein for encouraging the belief that high-precision computations are useful in “experimental” mathematics [4], e.g. in the PSLQ algorithm [16]. Ben F. “Tex” Logan, Jr. (unpublished observation, mentioned in [18, Sect. 6.5]) suggested the use of Tangent numbers to compute Bernoulli numbers. Christian Reinsch (about 1979, acknowledged in [6], Personal communication to R.P. Brent) pointed out the numerical instability of the recurrence (8.7) and suggested the use of the numerically stable recurrence (8.8). Christopher Heckman kindly drew our attention to Atkinson’s algorithm [2]. We thank Paul Zimmermann for his comments. Some of the material presented here is drawn from the recent book Modern Computer Arithmetic [7] (and as-yet-unpublished solutions to exercises in the book). In particular, see [7, Sect. 4.7.2 and Exercises 4.35–4.41]. Finally, we thank David Bailey, Richard Crandall, and two anonymous referees for suggestions and pointers to additional references.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Richard P. Brent .

Editor information

Editors and Affiliations

Additional information

Note added in proof

Recently the second author [A subquadratic algorithm for computing the n-th Bernoulli number, arXiv:1209.0533, to appear in Mathematics of Computation] has given an improved algorithm for the computation of a single Bernoulli number. The new algorithm reduces the exponent from 2 + o(1) to \(4/3 + o(1)\).

Communicated by David H. Bailey.

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer Science+Business Media New York

About this paper

Cite this paper

Brent, R.P., Harvey, D. (2013). Fast Computation of Bernoulli, Tangent and Secant Numbers. In: Bailey, D., et al. Computational and Analytical Mathematics. Springer Proceedings in Mathematics & Statistics, vol 50. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-7621-4_8

Download citation

Publish with us

Policies and ethics