numclassify 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- numclassify/__init__.py +63 -0
- numclassify/__main__.py +4 -0
- numclassify/_core/__init__.py +0 -0
- numclassify/_core/combinatorial.py +392 -0
- numclassify/_core/digital.py +403 -0
- numclassify/_core/divisors.py +756 -0
- numclassify/_core/figurate.py +357 -0
- numclassify/_core/number_theory.py +533 -0
- numclassify/_core/powers.py +349 -0
- numclassify/_core/primes.py +2100 -0
- numclassify/_core/recreational.py +245 -0
- numclassify/_core/sequences.py +488 -0
- numclassify/_registry.py +417 -0
- numclassify/cli.py +525 -0
- numclassify-0.1.0.dist-info/METADATA +220 -0
- numclassify-0.1.0.dist-info/RECORD +19 -0
- numclassify-0.1.0.dist-info/WHEEL +4 -0
- numclassify-0.1.0.dist-info/entry_points.txt +2 -0
- numclassify-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: numclassify
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The most comprehensive Python library for number classification — 3000+ number types
|
|
5
|
+
Project-URL: Homepage, https://github.com/aratrikghosh2011-tech/numclassify
|
|
6
|
+
Project-URL: Repository, https://github.com/aratrikghosh2011-tech/numclassify
|
|
7
|
+
Project-URL: Issues, https://github.com/aratrikghosh2011-tech/numclassify/issues
|
|
8
|
+
Author-email: Aratrik Ghosh <aratrikghosh2011@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: armstrong,classification,figurate,mathematics,number-theory,prime
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# numclassify
|
|
28
|
+
|
|
29
|
+
> The most comprehensive Python library for number classification — 3000+ number types, zero dependencies.
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/numclassify/)
|
|
32
|
+
[](https://pypi.org/project/numclassify/)
|
|
33
|
+
[](https://github.com/aratrikghosh2011-tech/numclassify/blob/main/LICENSE)
|
|
34
|
+
[](https://github.com/aratrikghosh2011-tech/numclassify/actions/workflows/ci.yml)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Why numclassify?
|
|
39
|
+
|
|
40
|
+
Most number-theory libraries — `labmath`, `eulerlib`, `pyntlib` — answer *computational* questions: factor this, find the GCD, generate primes up to N.
|
|
41
|
+
|
|
42
|
+
`numclassify` answers a different question: **what kind of number is this?**
|
|
43
|
+
|
|
44
|
+
- `153` → Armstrong, Narcissistic, Harshad, Triangular, Abundant…
|
|
45
|
+
- `1729` → Taxicab (Hardy-Ramanujan), Zeisel, Carmichael…
|
|
46
|
+
- `28` → Perfect, Triangular, Hexagonal, Semiprime…
|
|
47
|
+
|
|
48
|
+
Over **3000 named number types**, instant lookup, no external dependencies.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install numclassify
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or clone and install in editable mode:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/aratrikghosh2011-tech/numclassify.git
|
|
62
|
+
cd numclassify
|
|
63
|
+
pip install -e .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import numclassify as nc
|
|
72
|
+
|
|
73
|
+
# Boolean checks
|
|
74
|
+
nc.is_prime(17) # True
|
|
75
|
+
nc.is_armstrong(153) # True
|
|
76
|
+
nc.is_perfect(28) # True
|
|
77
|
+
|
|
78
|
+
# All true properties of a number
|
|
79
|
+
nc.get_true_properties(1729)
|
|
80
|
+
# ['taxicab', 'zeisel', 'carmichael', 'odd', 'composite',
|
|
81
|
+
# 'deficient', 'squarefree', 'cubefree', 'powerful_not_perfect_power']
|
|
82
|
+
|
|
83
|
+
# Search a range
|
|
84
|
+
nc.find_in_range(nc.is_armstrong, 1, 10000)
|
|
85
|
+
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474]
|
|
86
|
+
|
|
87
|
+
# Pretty-print everything about a number
|
|
88
|
+
nc.print_properties(153)
|
|
89
|
+
# ┌─────────────────────────────────────────┐
|
|
90
|
+
# │ Properties of 153 │
|
|
91
|
+
# ├─────────────────────────────────────────┤
|
|
92
|
+
# │ armstrong ✓ │
|
|
93
|
+
# │ harshad ✓ │
|
|
94
|
+
# │ triangular ✓ │
|
|
95
|
+
# │ ... │
|
|
96
|
+
# └─────────────────────────────────────────┘
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## CLI
|
|
102
|
+
|
|
103
|
+
numclassify ships with a fully-featured command-line interface.
|
|
104
|
+
|
|
105
|
+
**Check a number:**
|
|
106
|
+
```bash
|
|
107
|
+
$ numclassify check 1729
|
|
108
|
+
1729 properties:
|
|
109
|
+
taxicab ✓
|
|
110
|
+
carmichael ✓
|
|
111
|
+
zeisel ✓
|
|
112
|
+
odd ✓
|
|
113
|
+
deficient ✓
|
|
114
|
+
squarefree ✓
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**JSON output (pipe-friendly):**
|
|
118
|
+
```bash
|
|
119
|
+
$ numclassify check 153 --json
|
|
120
|
+
{"armstrong": true, "harshad": true, "triangular": true, "abundant": true, ...}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Find numbers of a type:**
|
|
124
|
+
```bash
|
|
125
|
+
$ numclassify find armstrong --limit 10
|
|
126
|
+
1, 2, 3, 4, 5, 6, 7, 8, 9, 153
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Filter a range:**
|
|
130
|
+
```bash
|
|
131
|
+
$ numclassify range 1 20 --filter prime
|
|
132
|
+
2, 3, 5, 7, 11, 13, 17, 19
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**List all registered types in a category:**
|
|
136
|
+
```bash
|
|
137
|
+
$ numclassify list --category primes
|
|
138
|
+
twin_prime, mersenne_prime, sophie_germain_prime, safe_prime,
|
|
139
|
+
wilson_prime, fermat_prime, ... (41 total)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Get info about a type:**
|
|
143
|
+
```bash
|
|
144
|
+
$ numclassify info armstrong
|
|
145
|
+
Name: armstrong
|
|
146
|
+
Category: digital_invariants
|
|
147
|
+
Description: A number equal to the sum of its digits each raised to the power
|
|
148
|
+
of the number of digits. Also called narcissistic numbers.
|
|
149
|
+
OEIS: A005188
|
|
150
|
+
Examples: 1, 2, 3, 153, 370, 371, 407, 1634, 8208, 9474
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Number Categories
|
|
156
|
+
|
|
157
|
+
| Category | Count | Examples |
|
|
158
|
+
|---|---|---|
|
|
159
|
+
| Polygonal (figurate) | 998 | Triangular, Square, Pentagonal … Chiliagonal |
|
|
160
|
+
| Centered Polygonal | 998 | Centered Triangular, Centered Hexagonal … |
|
|
161
|
+
| Prime families | 41 | Twin, Mersenne, Sophie Germain, Wilson, Safe… |
|
|
162
|
+
| Digital invariants | 10 | Armstrong, Spy, Harshad, Disarium, Happy, Neon… |
|
|
163
|
+
| Divisor-based | 27 | Perfect, Abundant, Weird, Amicable, Practical… |
|
|
164
|
+
| Sequences | 15 | Fibonacci, Lucas, Catalan, Bell, Padovan… |
|
|
165
|
+
| Powers | 13 | Perfect Square, Taxicab, Sum of Two Squares… |
|
|
166
|
+
| Number theory | 14 | Evil, Carmichael, Keith, Autobiographical… |
|
|
167
|
+
| Combinatorial | 10 | Factorial, Primorial, Subfactorial, Catalan… |
|
|
168
|
+
| Recreational | 5 | Kaprekar, Automorphic, Palindrome… |
|
|
169
|
+
| **Total** | **3000+** | |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Adding Your Own Number Type
|
|
174
|
+
|
|
175
|
+
The `@register` decorator lets you plug in custom types in 6 lines:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from numclassify import register
|
|
179
|
+
|
|
180
|
+
@register(name="my_type", category="custom")
|
|
181
|
+
def is_my_type(n: int) -> bool:
|
|
182
|
+
return n > 0 and n % 7 == 0 and str(n)[0] == "4"
|
|
183
|
+
|
|
184
|
+
# Now works everywhere
|
|
185
|
+
import numclassify as nc
|
|
186
|
+
nc.is_my_type(49) # False (doesn't start with 4)
|
|
187
|
+
nc.is_my_type(42) # True
|
|
188
|
+
nc.get_true_properties(42) # [..., 'my_type', ...]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## API Reference
|
|
194
|
+
|
|
195
|
+
| Function | Description |
|
|
196
|
+
|---|---|
|
|
197
|
+
| `is_prime(n)` | Returns `True` if `n` is a standard prime |
|
|
198
|
+
| `is_armstrong(n)` | Returns `True` if `n` is a narcissistic/Armstrong number |
|
|
199
|
+
| `get_all_properties(n)` | Dict of every registered type → `True`/`False` |
|
|
200
|
+
| `get_true_properties(n)` | List of only the properties that are `True` |
|
|
201
|
+
| `print_properties(n)` | Pretty-prints a formatted property table to stdout |
|
|
202
|
+
| `find_in_range(fn, lo, hi)` | All integers in `[lo, hi]` where `fn` returns `True` |
|
|
203
|
+
| `find_all_in_range(lo, hi)` | Dict mapping every number in range to its true properties |
|
|
204
|
+
| `count_properties(n)` | Count of how many types apply to `n` |
|
|
205
|
+
| `most_special_in_range(lo, hi)` | The number in `[lo, hi]` with the most true properties |
|
|
206
|
+
|
|
207
|
+
Full API docs: [github.com/aratrikghosh2011-tech/numclassify](https://github.com/aratrikghosh2011-tech/numclassify)
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Requirements
|
|
212
|
+
|
|
213
|
+
- Python 3.8 or higher
|
|
214
|
+
- Zero external dependencies
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT © 2026 Aratrik Ghosh
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
numclassify/__init__.py,sha256=RpyRHSFIvzO0laDBaES9w4obaFgjl63e0RVstx4aies,1847
|
|
2
|
+
numclassify/__main__.py,sha256=Uo95F9uoTqpqCL6wuHTNqjhZgrpQfjasA7qw3GRvfTU,98
|
|
3
|
+
numclassify/_registry.py,sha256=GgDCvO45YN9SOS_k0n6_VZvCM65fS0iL4_4bKnerubw,11310
|
|
4
|
+
numclassify/cli.py,sha256=DXHJdgOuszl6NoK4oSg6tRxIDgnxa8860enEd7iD6Rk,16563
|
|
5
|
+
numclassify/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
numclassify/_core/combinatorial.py,sha256=OmdNaXk34538F26pbrYeM_jDfbva2C1oq18S4yp2M58,9973
|
|
7
|
+
numclassify/_core/digital.py,sha256=42PRqCc3Zehcd0LBuf9NDtxGsQa-Sx0jxmZEBPtyxIo,8862
|
|
8
|
+
numclassify/_core/divisors.py,sha256=plem-AnBrAHbgUkqRMFiHM7PkvbMZqGqXdI5Cz-DilM,17233
|
|
9
|
+
numclassify/_core/figurate.py,sha256=X40hLYLxzqco6aMVJ57UlsAKenkPDCU1NlWQw8w6Z9g,11180
|
|
10
|
+
numclassify/_core/number_theory.py,sha256=TpvScMfi2AdaxmYuh_V3nx1WGT0-GVf2G2EvgefxvXY,12168
|
|
11
|
+
numclassify/_core/powers.py,sha256=HbsG7q08SZSSwd25WXbubtHLBn0CEtMABKV1tT01hz8,7767
|
|
12
|
+
numclassify/_core/primes.py,sha256=_KkYA6F4k6eDN8eAthPsrsJg0PlJMS-7k6R5Xfn3h0s,48894
|
|
13
|
+
numclassify/_core/recreational.py,sha256=iPc-7l_0o-pvUG2pF85gxgJKzT_j7n92s78yASS36zU,5957
|
|
14
|
+
numclassify/_core/sequences.py,sha256=sYOIFKfyw8eLdqLbtjJYWWj_J62n7MXtPAY7IociqAA,11220
|
|
15
|
+
numclassify-0.1.0.dist-info/METADATA,sha256=zcKz4rtah0hULoVKlaqRpJ3y3NPk0lRlCnHV1Qe2eyg,7364
|
|
16
|
+
numclassify-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
17
|
+
numclassify-0.1.0.dist-info/entry_points.txt,sha256=R4xPR2lbwwpXfn3udBwhDvwy7JMREW80eeRtM4l9mSs,53
|
|
18
|
+
numclassify-0.1.0.dist-info/licenses/LICENSE,sha256=pXh-SE4Y1rDyH9PkeNkxrPdnNv9ryBNaikhhzG9DJls,1071
|
|
19
|
+
numclassify-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aratrik Ghosh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|