---
title: "Discussion on \"How to find `n-th` root of a given 'x' algorithmically\" | Hashnode"
description: "Discussion on \"How to find `n-th` root of a given 'x' algorithmically\". def solve(x, n):\n    if x == 0:\n        return 0\n    lower = 0\n    upper = max(1, x)\n    mid = (lower + upper) / 2\n\n    while ((mid-lower) >= 0.001):\n        if (mid ** n > x):\n            upper = mid\n        else:\n            lower = mid\n        mid..."
url: "https://hashnode.com/posts/how-to-find-n-th-root-of-a-given-x-algorithmically/679116a5cca8fc79fb3c026a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to find \`n-th\` root of a given 'x' algorithmically](https://khushaalan.hashnode.dev/how-to-find-n-th-root-of-a-given-x-algorithmically?utm_source=hashnode&utm_medium=feed)

def solve(x, n): if x == 0: return 0 lower = 0 upper = max(1, x) mid = (lower + upper) / 2 while ((mid-lower) >= 0.001): if (mid \*\* n > x): upper = mid else: lower = mid mid...

Jan 22, 2025 · 1 min read · khushaalan.hashnode.dev  
Read the article

-   [#math](https://hashnode.com/tag/math)

## Written by

[khushaalan](https://hashnode.com/@khushaalan)

@khushaalan · San Francisco

  
[View profile](https://hashnode.com/@khushaalan)

Software Dev

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
