Skip to main content

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 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.

Why the modular functions matter: they use exact whole-number math, so they stay correct where plain ^ and % drift. For instance [7^77 % 1000] returns a wrong value because 7^77 is far too large to hold exactly, while [modpow(7,77,1000)] returns the exact 207. Factorials like [25!] are exact too. Inputs stay exact up to about 15 digits; for longer numbers use the Big Number Calculator.
Worked examples
FormulaResultWhat it does
[modpow(7,77,1000)]207Last 3 digits of a giant power, exactly.
[modinv(17,3120)]2753RSA-style modular inverse.
d=[modinv(A,26)]with A=5: d=21Inverse for cracking an affine cipher key.
[gcd(462,1071,3675)]21Common divisor of several numbers.
[xor(0xCA,0xFE)]52Bitwise XOR of two hex bytes.
N 51 [mod(A+B,60)]fills the minutesKeep a sum inside a coordinate range.