Formula Solver
Evaluate puzzle formulas with variables, ranges, and built-in functions.
Enter a formula and assign each letter variable a value. Wrap any part you want calculated in [ ] brackets, for example N 51 [A+B].[C*D] E 000 [E].[F-G]. Text outside the brackets is kept as is, so 5A.BCD simply fills in the digits. A variable can be a single value or a range such as 1-9 or 0;5;9, and every combination is solved. Alongside everyday math it also handles exact whole-number work: modular arithmetic, modular inverse, gcd and lcm, and bitwise operations, in decimal, hex, octal, or binary.
One formula per line. Reference an earlier line with {1}, {2}, and so on.
Variables found in the formula appear here. Enter a value or a range (1-9, 0;5;9) for each.
Supported functions, operators, and constants
Operators: + - * / ^ % (power and modulo), ! (factorial), and parentheses. The symbols × · ÷ and superscripts like 2³ also work.
Roots and logs: sqrt(x), nrt(x,n) (nth root), log(x) (base 10), ln(x), e(x).
Trig: sin cos tan (radians), sindeg cosdeg tandeg (degrees), and their arc… inverses.
Rounding: abs floor ceil sgn, round(x,decimals), min(…), max(…).
Geocaching helpers: cs(n) cross sum, csi(n) iterated cross sum, nth(n,start,end) pick digits, bww('TEXT') or av('TEXT') word value (A=1…Z=26), len('TEXT') length.
Modular and integer math: mod(a,b) remainder that is always 0 or positive (mod(-7,3) is 2), modpow(a,e,m) exact (a to the power e) mod m, modinv(a,m) modular inverse (the x with a·x ≡ 1 mod m), gcd(a,b,…), lcm(a,b,…).
Bitwise: and(a,b), or(a,b), xor(a,b), shl(a,n) shift left, shr(a,n) shift right.
Number bases: write hexadecimal, octal, or binary directly with 0x, 0o, 0b, for example 0xFF is 255 and and(0xFC,0x0F) is 12.
Constants: pi phi sqrt2 sqrt3 sqrt5 ln2 ln10.
How a formula is read
Brackets inside brackets: the inside one is worked out first, so [1+[2+3]] is 6.
Powers and minus: a power binds tighter than a minus sign, as in school math. [-2^2] is -4, [(-2)^2] is 4, [2^-2] is 0.25, and [2^3^2] is 2^(3^2) = 512.
Digits kept as typed: a bracket that holds only a variable prints the value exactly as you typed it. With A = 042, 30.[A] is 30.042. As soon as the variable takes part in math, such as [A+1], it is a number (43). A range with a leading zero keeps its width: 00-09 gives 00, 01, ... 09 and 08-12 gives 08, 09, 10, 11, 12.
A line with no brackets: it is worked out as math (2+3 gives 5), unless it already reads as a coordinate such as 51.5007 -0.1246 or is only digits such as 0153. Those stay exactly as typed.
Rounding: round works on the decimal you see, so [round(1.005,2)] is 1.01. Halves round up.
Limits: one range may hold at most 1,000,000 values and all the ranges together at most 2,000,000. Only the first 5,000 combinations are listed.
Worked examples
| Formula | Result | What it does |
|---|---|---|
| [modpow(7,77,1000)] | 207 | Last 3 digits of a giant power, exactly. |
| [modinv(17,3120)] | 2753 | RSA-style modular inverse. |
| d=[modinv(A,26)] | with A=5: d=21 | Inverse for cracking an affine cipher key. |
| [gcd(462,1071,3675)] | 21 | Common divisor of several numbers. |
| [xor(0xCA,0xFE)] | 52 | Bitwise XOR of two hex bytes. |
| N 51 [mod(A+B,60)] | fills the minutes | Keep a sum inside a coordinate range. |