On this page
  1. math.isqrt
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

math.isqrt

Prev: math.isnan | Up: math
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.isqrt
Tags: #public #python3 #stdlib #math


Import

import math
from math import isqrt

Signature & Overview

math.isqrt(n, /)

Return the integer part of the square root of the input.

Usage

import math

assert math.isqrt(16) == 4
assert math.isqrt(17) == 4
assert math.isqrt(10**40) == 10**20

Gotchas

REPL Inspect

from math import isqrt
help(isqrt)

Linked from

Related notes