Skip to main content

UpfPy

This package includes a function, factor(); it takes an integer and returns a list.

This list represents the Unique Prime Factorization of a given integer.

https://simple.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic

https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic

The values of the list indices are such that the nth index contains the power on the nth prime in the Unique Prime Factorization of the given integer so that 2=[1], 3=[0,1] and 12=[2,1] and so fourth; the list terminates when the rest of the subsequent values are all zero.

These lists are stored in a file called vectors.txt as csv. The reason I made this is partly to generate that file. Next we will be adding a number of basic functions to analyze that file which is really a model of the prime factor structure inside integers; and also I want to make it faster and make it reflect other aspects of prime numbers such as all primes greater than 3 are either 1 or 5 modulo 6.

Installation

Run the following to install:

pip install upfpy

Usage

The first time upfpy is imported it will create a file, vectors.txt; from here on out will refer to the lists produced by factor() as vectors. The inital file contains four rows.

The first row will be a csv list of primes and the initial file will just have a 2 here. When factor() is given a number, say N, greater than 2, all the primes less than N will appended here after a comma; it will append N if N is prime. The subsequent rows are vectors, i.e., unique prime factor lists.

The second row will contain an empty bracket [ ], this represents the integer zero and is the "null" or "empty" vector.

The third row represents the number one and contains a '0'. Consider:

1 = (2**0)*(3**0)*(5**0)*(7**0)...(n**0)... = [0,0,0,0,...] = [0]; where n is the nth prime

which is not true in python but it's true in math and we are modeling this structure using python.

The forth row represents the integer 2 and contains a '1'; because...

2 = (2**1)*(3**0)*(5**0)... = [1,0,0,...] = [1]

...python
>>> from upfpy import *
>>> factor(30)
[1,1,1]

There is one class, UFD() in upfpy and it has two subclasses Generate() and Show(); I will relocate and change this. Generate() is used to calculate vectors that arent already in vectors.txt and writes them to there as needed.

If you exectued factor(30) as earlier you could execute:

>>> UFD().primes
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

also note:

>>> UFD().vectors[1:6]
[[0], [1], [0, 1], [2], [0, 0, 1]]

and:

>>> UFD().show()
0 []
1 [0]
2 [1]
3 [0, 1]
4 [2]
5 [0, 0, 1]
...
28 [2, 0, 0, 1]
29 [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
30 [1, 1, 1]

Metadata

Release files for upfpy 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for upfpy 0.0.10
File Size Uploaded Provenance
upfpy-0.0.10.tar.gz 9.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for upfpy 0.0.10
File Interpreter ABI Platform
upfpy-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / upfpy-0.0.10.tar.gz

Download URL upfpy-0.0.10.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6386ef55f08a5de97b5574d846caa1ebc919013ec73584a3707d7702acf4fa81
BLAKE2b-256 checksum
How to use checksums
f4bd8d0d10055a797f210e7a55f02cc897771dc8eba3bd2b017d154ba2ee46c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

Release files / upfpy-0.0.10-py3-none-any.whl

Download URL upfpy-0.0.10-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8e56f7a7d8a8da1acfaf9fd08b73177095af4e3a7136dea869b8cdda049d457
BLAKE2b-256 checksum
How to use checksums
72181f5b8bc3a91319ce4af4bfd69f0860eaeb2644366414cfb613292b0774f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

Security for upfpy 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page