Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Diplomacy is the art of saying "nice doggy" until you can find a rock.


devel / comp.lang.python / Suggestion for unlimited-precision integer roots

SubjectAuthor
o Suggestion for unlimited-precision integer rootsKevin O'Gorman

1
Suggestion for unlimited-precision integer roots

<152471f6-1bc6-488d-8051-e14f57926a16n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24939&group=comp.lang.python#24939

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ac8:5a0f:0:b0:42a:4601:6fd3 with SMTP id n15-20020ac85a0f000000b0042a46016fd3mr14319qta.8.1706302288876;
Fri, 26 Jan 2024 12:51:28 -0800 (PST)
X-Received: by 2002:a05:6870:219b:b0:214:7e9d:a73b with SMTP id
l27-20020a056870219b00b002147e9da73bmr12040oae.7.1706302288664; Fri, 26 Jan
2024 12:51:28 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Fri, 26 Jan 2024 12:51:28 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=174.87.141.6; posting-account=AYCZqgoAAAAu5f18a0-593o-Om93OIxD
NNTP-Posting-Host: 174.87.141.6
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <152471f6-1bc6-488d-8051-e14f57926a16n@googlegroups.com>
Subject: Suggestion for unlimited-precision integer roots
From: kevinogo...@gmail.com (Kevin O'Gorman)
Injection-Date: Fri, 26 Jan 2024 20:51:28 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2294
 by: Kevin O'Gorman - Fri, 26 Jan 2024 20:51 UTC

I have developed a Python program that computes integer roots to unlimited precision. At the time, I was not even aware of python decimal package, so it works on strings for non-integer inputs (but still only integer roots of them). Internally it uses Python's native unlimited precision integers.

Anyway, It occurs to me this could be useful in the decimal package -- and maybe elsewhere as well.

The code is in https://github.com/kogorman/pyroot, and is intended for public consumption.

If there's already a Python feature that does this, I'd appreciate hearing about it.

I developed this because I kept remembering a grade-school teacher who taught us how to extract square roots -- and that he commented that there was no similar paper-and-pencil way to extract higher roots. Then, as it happens, 7 decades later or so, I was looking at the details of the square-root method to see what made it work, and I saw that it was based on the formula for (a+b)**2 -- the usual binomial formula. It seemed obvious that higher-valued binomials could also be used, and that's how it worked out. I've tested very large values of the root -- in the thousands -- and verified that the results work.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor