6∧ᵇ32ₓ
Continue from Rearranging and transforming arrays.
ᵇ (Bitwise)In binary, the digit positions have values 1, 2, 4, and so on, counting from the right. The digits are 0 or 1, called bits. Six is binary 110 and three is 011. Bitwise applies a Boolean function separately to each bit. ∧ keeps a 1 only where both have a 1, giving binary 010, or two:
⍭ (Primes)A prime is an integer greater than 1 divisible only by itself and 1. ⍭n gives the prime with n primes before it. Position 0 is the prime 2:
On a prime, the inverse gives its position. It counts the primes strictly below its argument, including when the argument is not itself prime:
A left argument chooses another prime operation. Code 1 tests whether a number is prime; code 2 gives the next prime:
⨸ (Factors)A number’s prime factors are primes whose product is that number. Factors gives them in ascending order, with repetitions. Multiplying them recovers the number:
Factors’ inverse multiplies the factor list back into the number.
An exponent counts the copies of one prime factor in the product. A left argument of ¯∞ gives a table of distinct factors above their exponents:
⌻ (Polynomials)A polynomial is a sum of multiples of nonnegative integer powers, such as 1 + 2x + 3x². The multipliers 1 2 3 are its coefficients, starting with the constant term: the part without x. Fixing that left argument makes a polynomial function:
Derivative applies to this function too:
A root is an input where the polynomial is zero. With one argument, ⌻ gives the coefficient of the highest power and the approximate roots. For x² − 3x + 2, that coefficient is 1 and the roots are 1 and 2:
The inverse rebuilds the coefficients from the highest-power coefficient and roots.
⇄ (Optimize)Optimize searches for the point where a function is least, starting from its argument. The squared distance from 2 is least at 2:
With "solve":$t, it instead searches for a zero. This finds the positive square root of 2, starting from 1: