ForHosting KIT · Developer Utilities

Hensel lifting calculator

The Hensel lifting calculator takes an integer polynomial, a known root modulo a prime p, and a target exponent k.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

It applies the simple-root form of Hensel's lemma to produce the unique compatible root modulo p^k. Every calculation uses exact integer arithmetic, and the result includes each intermediate modulus, root, and correction digit so you can inspect or reproduce the lift rather than accepting an unexplained final residue. The full congruence chain remains visible.

Enter the polynomial and the root in a precise form

Supply the polynomial as coefficients in ascending degree order. For example, [-2, 0, 1] means x squared minus 2: the first entry is the constant coefficient, the second multiplies x, and the third multiplies x squared. Then provide a prime p, an integer root, and the target exponent k. The supplied root may be any integer representative; the calculator first reduces it to the standard residue from zero through p minus one. Before lifting, it verifies that evaluating the polynomial at that residue gives zero modulo p. It also checks that p really is prime and that the polynomial has positive degree. These checks matter because Hensel's lemma is not a way to search blindly for an initial modular root. It begins with a root that is already known at the first prime level. If that prerequisite fails, the calculator returns a clear input error instead of presenting a residue that has no mathematical justification.

Understand the simple-root Hensel step

Suppose the current root r works modulo p raised to n. The next compatible candidate has the form r plus t times p raised to n, where t is one digit modulo p. Dividing the current polynomial value by p raised to n and multiplying by the inverse of the derivative determines that correction digit. The calculator performs this operation one level at a time until it reaches p^k. The crucial hypothesis is that the formal derivative at the initial root is nonzero modulo p. That makes the derivative invertible, so each correction digit exists and is unique. If the derivative vanishes modulo p, this capability deliberately stops with an error. Singular roots need a more general analysis: they may have no lift, several lifts, or behavior that changes at later powers. Silently selecting one branch would misrepresent the simple-root theorem and could make downstream computations appear uniquely determined when they are not.

Read and verify the returned lift

The main root field is the least nonnegative representative modulo the returned modulus p^k. Both are decimal strings so exact values remain intact even after they grow beyond JavaScript's safe numeric range. The exponent confirms the requested level, derivative_mod_p records the nonzero derivative residue used by the calculation, and verified states whether direct substitution produces zero modulo the final modulus. The lifts array begins at exponent one and records every successive root and modulus. From the second entry onward, correction_digit is the base-p digit added at that stage. This trace is useful for homework checks, worked examples, algorithm tests, and reproducible research notes. You can independently evaluate the polynomial at any listed root and confirm divisibility by its listed modulus. Remember that the result is the unique lift congruent to the supplied starting root modulo p; a different root of the same polynomial modulo p generally leads to a different compatible p-adic branch.

Check a number theory exercise

Compare each correction digit with a hand calculation and verify the final residue modulo the requested prime power.

Build exact modular test vectors

Generate deterministic roots modulo increasing prime powers for testing symbolic algebra or modular arithmetic code.

Explore a p-adic branch

Follow one simple root through successive powers of p and inspect the base-p correction chosen at every level.

What coefficient order does the calculator use?

Ascending degree order. The array [a0, a1, a2] represents a0 + a1*x + a2*x^2.

Why must p be prime?

This capability implements the standard simple-root Hensel lemma over powers of a prime. A composite starting modulus requires a different setup.

Why does a zero derivative cause an error?

The simple-root formula needs the derivative to have an inverse modulo p. When it vanishes, a lift may be absent or non-unique, so this calculator does not guess.

Why are the root and modulus returned as strings?

Prime powers can exceed the safe integer range. Decimal strings preserve every digit exactly in JSON and browser code.

Does the initial root need to be between zero and p minus one?

No. Any safe integer representative is accepted and reduced modulo p before validation and lifting.

What does it cost?

The browser calculation is free. An API request costs $0.002.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/numth/hensel-lift

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/numth/hensel-lift \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"coefficients":[-2,0,1],"root":3,"p":7,"k":4}'
{
  "coefficients": [
    -2,
    0,
    1
  ],
  "root": 3,
  "p": 7,
  "k": 4
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.hensel_lift",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →