This site is supported by donations to The OEIS Foundation.

JavaScript

From OeisWiki
Jump to: navigation, search

This article page is a stub, please help by expanding it.


JavaScript (standardized as ECMAScript) is a general-purpose scripting language extensively used in Web browsers. Its principal use is to provide interactivity and do form validation. It is not designed for number theory but there are a few OEIS sequence entries that include JavaScript programs.

Using JavaScript code

To use JavaScript programs from the OEIS, you can copy and paste the program into the following HTML code, replacing the lines between the script tags. Save the plain text file with an *.htm or *.html file extension and load into any modern Web browser.

<html>

<head>
<title>Javascript OEIS program page</title>
</head>
<body>
<script><!--
maximum = 39;
var fibonacci = new Array();
fibonacci[0] = 0;
fibonacci[1] = 1;
for (i = 2; i < maximum; i++) { fibonacci[i] = fibonacci[i - 2] + fibonacci[i - 1]; }
document.write(fibonacci); // John Lopez, Jan 01 2000
//--></script>
<h1>Javascript OEIS program page</h1>
</body>

</html>

Alternately, you can paste the program into an online JavaScript IDE (see external links below).

Issues

One of the problems with using JavaScript for number theory is that all numbers are stored as IEEE 754 double64 floating-point numbers, and hence moderately large numbers (greater than about 1016) are stored inexactly.


External links