Formula sequence

The entries of this sequence are given by a mathematical formula that you enter in its parameters tab; for example (n+1)n/2 would generate the triangular numbers. The formula (unless you want it to be a constant, i.e., have all of its entries be the same) should mention the variable n. To generate the entry of this sequence at index 15 (say), Numberscope will substitute the value 15 in for n in the formula, and then evaluate the resulting expression. So to continue the above example, the entry at index 15 of the Formula sequence given by (n+1)n/2 will be 16*15/2, or 120.

All familiar arithmetic operations may be used in the formula:

+, -, *, /
addition, subtraction, multiplication, division. Note that as in typical mathematical notation, the * for multiplication may be omitted when the terms being multiplied can clearly be detected by the formula parser. So 2n is the same as 2*n, but you can't write ncos(n) for n*cos(n) because the parser doesn't know whether you perhaps meant the function name to be ncos.
^
exponentiation, e.g. 2^3 will produce 8
%
remainder, e.g. 18 % 5 will produce 3 because that's the remainder when dividing 18 by 5. Note that this is the so-called "mathematician's modulo": it is always a positive number, so -18 % 5 produces 2, not -3 as in JavaScript.
!
factorial, e.g. 4! will produce 4*3*2*1 = 24

In addition, there are numerous functions available that you can use, including:

sqrt()
square root, e.g. sqrt(25) will produce 5.
floor(), round(), ceil()
round to the next lowest, nearest, or next highest whole number, respectively. For example, floor(sqrt(35)) will also produce 5, because √35 is between 5 and 6. Note that since Numberscope specifically deals with integer sequences, floor() is automatically applied to the results of your formula if the result is not a whole number. For example, the entries of the Formula sequence n/3 starting at index 0 will be 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, ...
exp(), log()
Exponential and logarithm to base e.
sin(), cos(), tan(), sec(), csc(), cot()
Trigonometric functions. To get the inverse of these functions, prepend a to the name, i.e., atan(3) computes the arctangent or inverse tangent of 3.
combinations(n, k)
The (n,k)-th binomial coefficient, or the number of k-element subsets of an n-element set.

There are many more; for a full list, see the mathjs function reference. (Note that inside a Numberscope formula, you do not need to use the math. prefix shown for every entry in this reference.)

Parameters

  • Formula: The mathematical expression that defines the sequence, in mathjs formula notation. Generally, it should refer to the variable n, which will be set to the index of an entry in order to compute the value of that entry. (Specified as a string in valid mathjs syntax; defaults to n, which produces the sequence of natural numbers.)

Plus the standard parameters for all formulas:

  • First index: the first index of the sequence to use in visualization. Many sequences have a smallest available index; if so, that number will be the default value for thus parameter. Otherwise, the default will be zero.
  • Last index: the index of the last entry of the sequence to use in visualization. Similarly, many sequences have a largest available index, which will become the default value for this parameter. If not, the default is Infinity, which means that the visualizer may continue to request more and more terms indefinitely.
  • Number of terms: the number of terms of the sequence to use in visualization. Of course, the number of terms must be the last index, minus the first index, plus one. So this parameter and the previous two can not actually be independently set. What will happen in practice is that changing any one of them will automatically change the value of one of the others to keep things consistent. The default value for this parameter is determined by the first and last index.