A 32-bit integer. Integer inherits most of its behaviour from its superclass, SimpleNumber.
-2^31) to 2147483647 (2^31 - 1).
The overflow behavior of an Integer is undefined. This occurs whenever the result of an operation does not fit in the range of values supported by the return type, in this case, a 32-bit signed integer. Consider using the 64-bit Float for larger numbers (up to ±2^53).
Executes function for all integers from zero to this minus one.
| function |
a Function which is passed two arguments, both of which are the same integer from zero to this minus one. The reason two arguments are passed is for symmetry with the implementations of do in Collection. |
Executes function for all integers from this minus one to zero.
Executes function for all integers from this to endval, inclusive.
| endval |
an Integer. |
| function |
a Function which is passed two arguments, the first which is an integer from this to endval, and the second which is a number from zero to the number of iterations minus one. |
Executes function for all integers from this to endval, inclusive, stepping each time by stepval.
| endval |
an Integer. |
| stepval |
an Integer. |
| function |
a Function which is passed two arguments, the first which is an integer from this to endval, and the second which is a number from zero to the number of iterations minus one. |
an Array of this size filled by objects generated from evaluating the function.
a Collection of class of this size filled by objects generated from evaluating the function.
an Interval from this to hi.
an array with a geometric series of this size from start.
an array with a fibonacci series of this size beginning with a and b.
the prime factors as array.
See also: Randomness
| exclude |
an Integer. |
a random value from zero to this, excluding the value exclude.
| exclude |
an Integer. |
a random value from this.neg to this, excluding the value exclude.
a Char which has the ASCII value of the receiver.
a Char which represents the receiver as an ASCII digit.
For example 5.asDigit returns $5.
an array with the binary digits (integer 0 or 1).
an array with the n-ary digits.
See also the complementary method SequenceableCollection: -convertDigits.
a string with the binary digits (0 or 1).
a string with the hexadecimal digits (integer 0 to F).
a string in IP format.
a string with width-rightmost digits in base base.
the receiver.
Interpret this as index into a scale with a given number of steps per ocatve.
the gray code for the number.
a hash value.
set nth bit to zero (bool = false) or one (bool = true)
{ _CLZ }
{ _CTZ }
number of required bits
true if dividable by 2 with no rest
true if not dividable by 2 with no rest
the next power of two greater than or equal to the receiver.
the whether the receiver is a power of two.
the nth prime number. The receiver must be from 0 to 6541.
the next prime less than or equal to the receiver up to 65521.
the next prime less than or equal to the receiver up to 65521.
whether the receiver is prime.
the index of a prime number less than or equal to the receiver up to 65521. If the receiver is not a prime, the answer is nil.
Multiplication.
Addition.
Subtraction.
Pre-3.14 modulo with unexpected behavior for negative integer modulus.
For dividends smaller than a negative divisor, modSeaside pulls the resulting remainder below the divisor. It thereby leaves zero as peaks on the zero line. Like in the usual mod, all larger dividends result in remainders above zero.
lo and hilo if the receiver is less than lohi if the receiver is greater than hiThe result is an Integer only if both lo and hi are Integers.
the factorial of the receiver as an integer. This will overflow for numbers > 12 and throw an error. Floating point factorials can be used in such cases (see: SimpleNumber: -factorial).
Folds in to a value between lo and hi.
an Integer between lo and hi.
next larger integer of the base 2 logarithm of the receiver.
Wraps in to a value between lo and hi.
an Integer between lo and hi.
Return this if lo <= this <= hi, otherwise return the nearest boundary: lo if this < lo, hi if this > hi.
| lo |
The low threshold of clipping. |
| hi |
The high threshold of clipping. |
Fold this to [lo, hi].
| lo |
The low threshold of folding. |
| hi |
The high threshold of folding. |
Wrap this around [lo, hi] such that it falls in range. Equivalent to (this % (hi - lo + 1)) + lo. Note that this behavior is different from Float: -wrap.
| lo |
The low threshold (inclusive) of wrapping. |
| hi |
The high threshold (inclusive) of wrapping. |
exits the sclang program and returns the receiver as an exit code to the parent process (e.g. Unix shell).
calls function.value(receiver) but returns the receiver.
true (the receiver is an integer).
a Boolean for whether or not the given key modifier is in effect. For a list of these, see Modifier Keys.
a Boolean for whether or not the specified pid is running.
a new HoaOrder instance.
a new HoaDegree instance.
Browse Math/Cycle
Cycle includes the methods Array: -campanology, Array: -circPerm, Array: -interlace, Array: -kaprekar, Array: -kreuzspiel, Array: -pea, Array: -sieve, Array: -symGroup, Array: -symPerm, Integer: -campanology, Integer: -circPerm, Integer: -collatz, Integer: -discreteLog, Integer: -euclidean, Integer: -kaprekar, Integer: -pea, Number: -lorenz, Env: *collatz.
Apply the method Array: -campanology on positive integers.
| mode |
assigns the first switched couple as indices either 0 or 1. |
| rev |
Boolean, stops the algorithm when its input is reversed. |
| sym |
Boolean, 'escape from hunt' as a palindromic process for odd number of bells. |
the cycle itself.
| iBase |
in/out base |
| cBase |
circular base |
the cycle as a circular permutation according to the radix as arguments.
See also Array: -circPerm.
In 1928, Lothar Collatz invented a sequence built from a positive integer according to the following rules:
if x(n) is even, then x(n+1) is equal to x(n) divided by 2;
if x(n) is odd, then x(n+1) is equal to 1 plus x(n) multiplied by 3.
The series thus constructed always ends – until the contrary is proved – by a trivial cycle (4 2 1) for positive integers. This hypothesis is called Syracuse conjecture.
the 'path' if it exists until the cycle itself.
The discrete logarithm forms a cyclic group according to its reciprocal modular exponential defined by g^i mod p.
| mod |
modulo |
The cycle itself.
Application of Bjorklund's algorithm of uniformly distributing some rhythmic impacts in a given interval of rhythmic units – according to Euclid's algorithm determining the greatest common divisor (GCD) [Book VII of the Elements of Euclid].
Reference at http://cgm.cs.mcgill.ca/~godfried/publications/banff.pdf
| n |
total 'duration' as a number of pulses |
| ratio |
Boolean |
a binary sequence or an array of relative durations if ratio is set to true.
The Kaprekar's algorithm consists to associate any number x to another number K(x) generated as follow:
According to the digits of x in radix n, one forms the number x1 by ranking in increasing order these digits and the number x2 by ranking in decreasing order.
Then K(x) = x2 - x1.
The process is iterated until a cyclic redundancy.
| base |
the cycle itself prepended by its 'path' if it exists.
Apply the method Array: -pea to a single positive integer.
cycle itself prepended by its 'path' if it exists.
perfect power decomposition
if the receiver can be decomposed into an integer base raised to an integer power, return the base and power as an array, otherwise return nil.
the returned decomposition is in minimal exponent form
the perfect square root of the number
if an integer square root can be found, return, otherwise return nil.
the perfect cube root of the number
if an integer cube root can be found, return, otherwise return nil.
the perfect root of the number
if an integer root can be found, return, otherwise return nil.
answer if the receiver can be decomposed into an integer base raised to an integer power
observes the convention where the first perfect power is 4
Calculates the least common multiple by using the greatest common divisor. This can avoid problems with large numbers. See Sieves and Psieve patterns: 4b
| ... args |
Integers |
Calculates the least common multiple by prime factors. This can avoid problems with large numbers. Returns an array with lcm as first item, an array with prime factors of lcm as second item and an array of receiver's and all arguments' prime factors. See Sieves and Psieve patterns: 4b
| ... args |
Integers |
the Discrete Fourier Transform sample frequencies.
the Discrete Fourier Transform sample frequencies.
the Discrete Fourier Transform sample frequencies.