numclassify 0.1.1__tar.gz → 0.2.0__tar.gz

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.
Files changed (81) hide show
  1. {numclassify-0.1.1 → numclassify-0.2.0}/.gitignore +1 -0
  2. {numclassify-0.1.1 → numclassify-0.2.0}/CHANGELOG.md +13 -0
  3. {numclassify-0.1.1 → numclassify-0.2.0}/PKG-INFO +69 -43
  4. {numclassify-0.1.1 → numclassify-0.2.0}/README.md +68 -42
  5. numclassify-0.2.0/docs/api.md +25 -0
  6. numclassify-0.2.0/docs/changelog.md +3 -0
  7. numclassify-0.2.0/docs/cli.md +22 -0
  8. numclassify-0.2.0/docs/index.md +23 -0
  9. numclassify-0.2.0/mkdocs.yml +26 -0
  10. numclassify-0.2.0/numclassify/__init__.py +172 -0
  11. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/cli.py +79 -3
  12. numclassify-0.2.0/numclassify/py.typed +0 -0
  13. {numclassify-0.1.1 → numclassify-0.2.0}/pyproject.toml +8 -2
  14. numclassify-0.2.0/site/404.html +490 -0
  15. numclassify-0.2.0/site/api/index.html +731 -0
  16. numclassify-0.2.0/site/assets/images/favicon.png +0 -0
  17. numclassify-0.2.0/site/assets/javascripts/bundle.79ae519e.min.js +16 -0
  18. numclassify-0.2.0/site/assets/javascripts/bundle.79ae519e.min.js.map +7 -0
  19. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.ar.min.js +1 -0
  20. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.da.min.js +18 -0
  21. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.de.min.js +18 -0
  22. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.du.min.js +18 -0
  23. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.el.min.js +1 -0
  24. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.es.min.js +18 -0
  25. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.fi.min.js +18 -0
  26. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.fr.min.js +18 -0
  27. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.he.min.js +1 -0
  28. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.hi.min.js +1 -0
  29. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.hu.min.js +18 -0
  30. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.hy.min.js +1 -0
  31. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.it.min.js +18 -0
  32. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.ja.min.js +1 -0
  33. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.jp.min.js +1 -0
  34. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.kn.min.js +1 -0
  35. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.ko.min.js +1 -0
  36. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.multi.min.js +1 -0
  37. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.nl.min.js +18 -0
  38. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.no.min.js +18 -0
  39. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.pt.min.js +18 -0
  40. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.ro.min.js +18 -0
  41. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.ru.min.js +18 -0
  42. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.sa.min.js +1 -0
  43. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +1 -0
  44. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.sv.min.js +18 -0
  45. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.ta.min.js +1 -0
  46. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.te.min.js +1 -0
  47. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.th.min.js +1 -0
  48. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.tr.min.js +18 -0
  49. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.vi.min.js +1 -0
  50. numclassify-0.2.0/site/assets/javascripts/lunr/min/lunr.zh.min.js +1 -0
  51. numclassify-0.2.0/site/assets/javascripts/lunr/tinyseg.js +206 -0
  52. numclassify-0.2.0/site/assets/javascripts/lunr/wordcut.js +6708 -0
  53. numclassify-0.2.0/site/assets/javascripts/workers/search.2c215733.min.js +42 -0
  54. numclassify-0.2.0/site/assets/javascripts/workers/search.2c215733.min.js.map +7 -0
  55. numclassify-0.2.0/site/assets/stylesheets/main.484c7ddc.min.css +1 -0
  56. numclassify-0.2.0/site/assets/stylesheets/main.484c7ddc.min.css.map +1 -0
  57. numclassify-0.2.0/site/assets/stylesheets/palette.ab4e12ef.min.css +1 -0
  58. numclassify-0.2.0/site/assets/stylesheets/palette.ab4e12ef.min.css.map +1 -0
  59. numclassify-0.2.0/site/changelog/index.html +533 -0
  60. numclassify-0.2.0/site/cli/index.html +732 -0
  61. numclassify-0.2.0/site/index.html +661 -0
  62. numclassify-0.2.0/site/search/search_index.json +1 -0
  63. numclassify-0.2.0/site/sitemap.xml +19 -0
  64. numclassify-0.2.0/site/sitemap.xml.gz +0 -0
  65. numclassify-0.1.1/numclassify/__init__.py +0 -63
  66. {numclassify-0.1.1 → numclassify-0.2.0}/.github/workflows/ci.yml +0 -0
  67. {numclassify-0.1.1 → numclassify-0.2.0}/.github/workflows/publish.yml +0 -0
  68. {numclassify-0.1.1 → numclassify-0.2.0}/LICENSE +0 -0
  69. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/__main__.py +0 -0
  70. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/__init__.py +0 -0
  71. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/combinatorial.py +0 -0
  72. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/digital.py +0 -0
  73. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/divisors.py +0 -0
  74. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/figurate.py +0 -0
  75. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/number_theory.py +0 -0
  76. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/powers.py +0 -0
  77. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/primes.py +0 -0
  78. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/recreational.py +0 -0
  79. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_core/sequences.py +0 -0
  80. {numclassify-0.1.1 → numclassify-0.2.0}/numclassify/_registry.py +0 -0
  81. {numclassify-0.1.1 → numclassify-0.2.0}/tests/test_registry.py +0 -0
@@ -1,3 +1,4 @@
1
+ .pytest_cache/
1
2
  __pycache__/
2
3
  *.pyc
3
4
  *.pyo
@@ -6,6 +6,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
6
6
 
7
7
  ---
8
8
 
9
+ ## [0.2.0] - 2026-05-11
10
+
11
+ ### Added
12
+ - `classify(n)` — returns `{"number": n, "true_properties": [...], "score": int}`
13
+ - `classify_batch(numbers)` — classify a list of numbers in one call
14
+ - `random_number(max_n=10000)` — classify a random number
15
+ - `find_by_property(start, end, **filters)` — query numbers by property name/value
16
+ - `stream(start, end)` — memory-safe generator yielding classify results
17
+ - `numclassify compare <a> <b> [--json]` — new CLI command showing shared/exclusive properties
18
+ - Windows ANSI color fix via `SetConsoleMode` VT100 flag
19
+ - `py.typed` marker added (PEP 561 compliant)
20
+ - Full type hints on all public API functions
21
+
9
22
  ## [0.1.1] - 2026-05-06
10
23
  ### Fixed
11
24
  - cli.py: Fixed imports to use numclassify._core instead of numclassify
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numclassify
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: The most comprehensive Python library for number classification — 3000+ number types
5
5
  Project-URL: Homepage, https://github.com/aratrikghosh2011-tech/numclassify
6
6
  Project-URL: Repository, https://github.com/aratrikghosh2011-tech/numclassify
@@ -26,26 +26,27 @@ Description-Content-Type: text/markdown
26
26
 
27
27
  # numclassify
28
28
 
29
- > The most comprehensive Python library for number classification — 3000+ number types, zero dependencies.
29
+ The most comprehensive Python library for number classification — 3000+ number types, zero dependencies.
30
30
 
31
31
  [![PyPI version](https://img.shields.io/pypi/v/numclassify)](https://pypi.org/project/numclassify/)
32
+ [![Downloads](https://img.shields.io/pypi/dm/numclassify)](https://pypi.org/project/numclassify/)
32
33
  [![Python versions](https://img.shields.io/pypi/pyversions/numclassify)](https://pypi.org/project/numclassify/)
33
34
  [![License MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/aratrikghosh2011-tech/numclassify/blob/main/LICENSE)
34
35
  [![Tests](https://img.shields.io/github/actions/workflow/status/aratrikghosh2011-tech/numclassify/ci.yml?label=tests)](https://github.com/aratrikghosh2011-tech/numclassify/actions/workflows/ci.yml)
35
36
 
36
37
  ---
37
38
 
38
- ## Why numclassify?
39
+ ## Overview
39
40
 
40
- Most number-theory libraries — `labmath`, `eulerlib`, `pyntlib` — answer *computational* questions: factor this, find the GCD, generate primes up to N.
41
+ Most number-theory libraries — `labmath`, `eulerlib`, `pyntlib` — are built around computation: factoring integers, finding GCDs, generating primes. `numclassify` solves a different problem: **given a number, what is it?**
41
42
 
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…
43
+ ```
44
+ 153 → Armstrong, Harshad, Triangular, Abundant ...
45
+ 1729 Taxicab (Hardy-Ramanujan), Carmichael, Zeisel ...
46
+ 28 Perfect, Triangular, Hexagonal, Semiprime ...
47
+ ```
47
48
 
48
- Over **3000 named number types**, instant lookup, no external dependencies.
49
+ Over **3000 named number types** are supported, with instant lookup, no external dependencies, and a fully typed API.
49
50
 
50
51
  ---
51
52
 
@@ -55,7 +56,7 @@ Over **3000 named number types**, instant lookup, no external dependencies.
55
56
  pip install numclassify
56
57
  ```
57
58
 
58
- Or clone and install in editable mode:
59
+ To install from source in editable mode:
59
60
 
60
61
  ```bash
61
62
  git clone https://github.com/aratrikghosh2011-tech/numclassify.git
@@ -71,20 +72,32 @@ pip install -e .
71
72
  import numclassify as nc
72
73
 
73
74
  # Boolean checks
74
- nc.is_prime(17) # True
75
- nc.is_armstrong(153) # True
76
- nc.is_perfect(28) # True
75
+ nc.is_prime(17) # True
76
+ nc.is_perfect(28) # True
77
+
78
+ # Classify a single number
79
+ nc.classify(1729)
80
+ # {'number': 1729, 'true_properties': ['Taxicab', 'Carmichael', ...], 'score': 22}
81
+
82
+ # Classify multiple numbers at once
83
+ nc.classify_batch([6, 28, 496])
84
+
85
+ # Query by property
86
+ nc.find_by_property(start=1, end=1000, Perfect=True)
87
+ # [6, 28, 496]
88
+
89
+ # Memory-safe streaming over large ranges
90
+ for result in nc.stream(1, 1_000_000):
91
+ if result['score'] > 30:
92
+ print(result)
93
+
94
+ # Random number classification
95
+ nc.random_number()
77
96
 
78
97
  # All true properties of a number
79
98
  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
99
 
87
- # Pretty-print everything about a number
100
+ # Pretty-print everything
88
101
  nc.print_properties(153)
89
102
  # ┌─────────────────────────────────────────┐
90
103
  # │ Properties of 153 │
@@ -132,6 +145,16 @@ $ numclassify range 1 20 --filter prime
132
145
  2, 3, 5, 7, 11, 13, 17, 19
133
146
  ```
134
147
 
148
+ **Compare two numbers:**
149
+ ```bash
150
+ $ numclassify compare 6 28
151
+ Comparing 6 and 28
152
+ ──────────────────
153
+ Shared (13): Perfect, Triangular, Hexagonal, ...
154
+ Only in 6 (21): Armstrong, Factorial, Palindrome, ...
155
+ Only in 28 (8): Happy, Keith, Padovan, ...
156
+ ```
157
+
135
158
  **List all registered types in a category:**
136
159
  ```bash
137
160
  $ numclassify list --category primes
@@ -156,23 +179,23 @@ Examples: 1, 2, 3, 153, 370, 371, 407, 1634, 8208, 9474
156
179
 
157
180
  | Category | Count | Examples |
158
181
  |---|---|---|
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 |
182
+ | Polygonal (figurate) | 998 | Triangular, Square, Pentagonal, Chiliagonal |
183
+ | Centered Polygonal | 998 | Centered Triangular, Centered Hexagonal |
184
+ | Prime families | 41 | Twin, Mersenne, Sophie Germain, Wilson, Safe |
185
+ | Digital invariants | 10 | Armstrong, Spy, Harshad, Disarium, Happy, Neon |
186
+ | Divisor-based | 27 | Perfect, Abundant, Weird, Amicable, Practical |
187
+ | Sequences | 15 | Fibonacci, Lucas, Catalan, Bell, Padovan |
188
+ | Powers | 13 | Perfect Square, Taxicab, Sum of Two Squares |
189
+ | Number theory | 14 | Evil, Carmichael, Keith, Autobiographical |
190
+ | Combinatorial | 10 | Factorial, Primorial, Subfactorial, Catalan |
191
+ | Recreational | 5 | Kaprekar, Automorphic, Palindrome |
169
192
  | **Total** | **3000+** | |
170
193
 
171
194
  ---
172
195
 
173
- ## Adding Your Own Number Type
196
+ ## Adding Custom Number Types
174
197
 
175
- The `@register` decorator lets you plug in custom types in 6 lines:
198
+ The `@register` decorator lets you define and integrate your own number types in a few lines. Once registered, the type is automatically available through the full API and CLI.
176
199
 
177
200
  ```python
178
201
  from numclassify import register
@@ -181,7 +204,6 @@ from numclassify import register
181
204
  def is_my_type(n: int) -> bool:
182
205
  return n > 0 and n % 7 == 0 and str(n)[0] == "4"
183
206
 
184
- # Now works everywhere
185
207
  import numclassify as nc
186
208
  nc.is_my_type(49) # False (doesn't start with 4)
187
209
  nc.is_my_type(42) # True
@@ -194,24 +216,28 @@ nc.get_true_properties(42) # [..., 'my_type', ...]
194
216
 
195
217
  | Function | Description |
196
218
  |---|---|
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` |
219
+ | `classify(n)` | Returns a dict with the number, its true properties, and a score |
220
+ | `classify_batch(numbers)` | Classify a list of numbers; returns a list of dicts |
221
+ | `random_number(max_n)` | Classify a randomly selected number up to `max_n` |
222
+ | `find_by_property(start, end, **filters)` | Find numbers in a range matching given property filters |
223
+ | `stream(start, end)` | Generator yielding classify results one at a time; memory-safe |
224
+ | `is_prime(n)` | Returns `True` if `n` is prime |
225
+ | `is_armstrong(n)` | Returns `True` if `n` is an Armstrong (narcissistic) number |
226
+ | `get_all_properties(n)` | Dict mapping every registered type to `True` or `False` |
227
+ | `get_true_properties(n)` | List of only the properties that hold for `n` |
201
228
  | `print_properties(n)` | Pretty-prints a formatted property table to stdout |
202
229
  | `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 |
230
+ | `count_properties(n)` | Number of types that apply to `n` |
231
+ | `most_special_in_range(lo, hi)` | Number in `[lo, hi]` with the greatest count of true properties |
206
232
 
207
- Full API docs: [github.com/aratrikghosh2011-tech/numclassify](https://github.com/aratrikghosh2011-tech/numclassify)
233
+ Full API documentation: [github.com/aratrikghosh2011-tech/numclassify](https://github.com/aratrikghosh2011-tech/numclassify)
208
234
 
209
235
  ---
210
236
 
211
237
  ## Requirements
212
238
 
213
239
  - Python 3.8 or higher
214
- - Zero external dependencies
240
+ - No external dependencies
215
241
 
216
242
  ---
217
243
 
@@ -1,25 +1,26 @@
1
1
  # numclassify
2
2
 
3
- > The most comprehensive Python library for number classification — 3000+ number types, zero dependencies.
3
+ The most comprehensive Python library for number classification — 3000+ number types, zero dependencies.
4
4
 
5
5
  [![PyPI version](https://img.shields.io/pypi/v/numclassify)](https://pypi.org/project/numclassify/)
6
+ [![Downloads](https://img.shields.io/pypi/dm/numclassify)](https://pypi.org/project/numclassify/)
6
7
  [![Python versions](https://img.shields.io/pypi/pyversions/numclassify)](https://pypi.org/project/numclassify/)
7
8
  [![License MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/aratrikghosh2011-tech/numclassify/blob/main/LICENSE)
8
9
  [![Tests](https://img.shields.io/github/actions/workflow/status/aratrikghosh2011-tech/numclassify/ci.yml?label=tests)](https://github.com/aratrikghosh2011-tech/numclassify/actions/workflows/ci.yml)
9
10
 
10
11
  ---
11
12
 
12
- ## Why numclassify?
13
+ ## Overview
13
14
 
14
- Most number-theory libraries — `labmath`, `eulerlib`, `pyntlib` — answer *computational* questions: factor this, find the GCD, generate primes up to N.
15
+ Most number-theory libraries — `labmath`, `eulerlib`, `pyntlib` — are built around computation: factoring integers, finding GCDs, generating primes. `numclassify` solves a different problem: **given a number, what is it?**
15
16
 
16
- `numclassify` answers a different question: **what kind of number is this?**
17
-
18
- - `153` Armstrong, Narcissistic, Harshad, Triangular, Abundant…
19
- - `1729` Taxicab (Hardy-Ramanujan), Zeisel, Carmichael…
20
- - `28` → Perfect, Triangular, Hexagonal, Semiprime…
17
+ ```
18
+ 153 → Armstrong, Harshad, Triangular, Abundant ...
19
+ 1729 Taxicab (Hardy-Ramanujan), Carmichael, Zeisel ...
20
+ 28 Perfect, Triangular, Hexagonal, Semiprime ...
21
+ ```
21
22
 
22
- Over **3000 named number types**, instant lookup, no external dependencies.
23
+ Over **3000 named number types** are supported, with instant lookup, no external dependencies, and a fully typed API.
23
24
 
24
25
  ---
25
26
 
@@ -29,7 +30,7 @@ Over **3000 named number types**, instant lookup, no external dependencies.
29
30
  pip install numclassify
30
31
  ```
31
32
 
32
- Or clone and install in editable mode:
33
+ To install from source in editable mode:
33
34
 
34
35
  ```bash
35
36
  git clone https://github.com/aratrikghosh2011-tech/numclassify.git
@@ -45,20 +46,32 @@ pip install -e .
45
46
  import numclassify as nc
46
47
 
47
48
  # Boolean checks
48
- nc.is_prime(17) # True
49
- nc.is_armstrong(153) # True
50
- nc.is_perfect(28) # True
49
+ nc.is_prime(17) # True
50
+ nc.is_perfect(28) # True
51
+
52
+ # Classify a single number
53
+ nc.classify(1729)
54
+ # {'number': 1729, 'true_properties': ['Taxicab', 'Carmichael', ...], 'score': 22}
55
+
56
+ # Classify multiple numbers at once
57
+ nc.classify_batch([6, 28, 496])
58
+
59
+ # Query by property
60
+ nc.find_by_property(start=1, end=1000, Perfect=True)
61
+ # [6, 28, 496]
62
+
63
+ # Memory-safe streaming over large ranges
64
+ for result in nc.stream(1, 1_000_000):
65
+ if result['score'] > 30:
66
+ print(result)
67
+
68
+ # Random number classification
69
+ nc.random_number()
51
70
 
52
71
  # All true properties of a number
53
72
  nc.get_true_properties(1729)
54
- # ['taxicab', 'zeisel', 'carmichael', 'odd', 'composite',
55
- # 'deficient', 'squarefree', 'cubefree', 'powerful_not_perfect_power']
56
-
57
- # Search a range
58
- nc.find_in_range(nc.is_armstrong, 1, 10000)
59
- # [1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474]
60
73
 
61
- # Pretty-print everything about a number
74
+ # Pretty-print everything
62
75
  nc.print_properties(153)
63
76
  # ┌─────────────────────────────────────────┐
64
77
  # │ Properties of 153 │
@@ -106,6 +119,16 @@ $ numclassify range 1 20 --filter prime
106
119
  2, 3, 5, 7, 11, 13, 17, 19
107
120
  ```
108
121
 
122
+ **Compare two numbers:**
123
+ ```bash
124
+ $ numclassify compare 6 28
125
+ Comparing 6 and 28
126
+ ──────────────────
127
+ Shared (13): Perfect, Triangular, Hexagonal, ...
128
+ Only in 6 (21): Armstrong, Factorial, Palindrome, ...
129
+ Only in 28 (8): Happy, Keith, Padovan, ...
130
+ ```
131
+
109
132
  **List all registered types in a category:**
110
133
  ```bash
111
134
  $ numclassify list --category primes
@@ -130,23 +153,23 @@ Examples: 1, 2, 3, 153, 370, 371, 407, 1634, 8208, 9474
130
153
 
131
154
  | Category | Count | Examples |
132
155
  |---|---|---|
133
- | Polygonal (figurate) | 998 | Triangular, Square, Pentagonal Chiliagonal |
134
- | Centered Polygonal | 998 | Centered Triangular, Centered Hexagonal |
135
- | Prime families | 41 | Twin, Mersenne, Sophie Germain, Wilson, Safe |
136
- | Digital invariants | 10 | Armstrong, Spy, Harshad, Disarium, Happy, Neon |
137
- | Divisor-based | 27 | Perfect, Abundant, Weird, Amicable, Practical |
138
- | Sequences | 15 | Fibonacci, Lucas, Catalan, Bell, Padovan |
139
- | Powers | 13 | Perfect Square, Taxicab, Sum of Two Squares |
140
- | Number theory | 14 | Evil, Carmichael, Keith, Autobiographical |
141
- | Combinatorial | 10 | Factorial, Primorial, Subfactorial, Catalan |
142
- | Recreational | 5 | Kaprekar, Automorphic, Palindrome |
156
+ | Polygonal (figurate) | 998 | Triangular, Square, Pentagonal, Chiliagonal |
157
+ | Centered Polygonal | 998 | Centered Triangular, Centered Hexagonal |
158
+ | Prime families | 41 | Twin, Mersenne, Sophie Germain, Wilson, Safe |
159
+ | Digital invariants | 10 | Armstrong, Spy, Harshad, Disarium, Happy, Neon |
160
+ | Divisor-based | 27 | Perfect, Abundant, Weird, Amicable, Practical |
161
+ | Sequences | 15 | Fibonacci, Lucas, Catalan, Bell, Padovan |
162
+ | Powers | 13 | Perfect Square, Taxicab, Sum of Two Squares |
163
+ | Number theory | 14 | Evil, Carmichael, Keith, Autobiographical |
164
+ | Combinatorial | 10 | Factorial, Primorial, Subfactorial, Catalan |
165
+ | Recreational | 5 | Kaprekar, Automorphic, Palindrome |
143
166
  | **Total** | **3000+** | |
144
167
 
145
168
  ---
146
169
 
147
- ## Adding Your Own Number Type
170
+ ## Adding Custom Number Types
148
171
 
149
- The `@register` decorator lets you plug in custom types in 6 lines:
172
+ The `@register` decorator lets you define and integrate your own number types in a few lines. Once registered, the type is automatically available through the full API and CLI.
150
173
 
151
174
  ```python
152
175
  from numclassify import register
@@ -155,7 +178,6 @@ from numclassify import register
155
178
  def is_my_type(n: int) -> bool:
156
179
  return n > 0 and n % 7 == 0 and str(n)[0] == "4"
157
180
 
158
- # Now works everywhere
159
181
  import numclassify as nc
160
182
  nc.is_my_type(49) # False (doesn't start with 4)
161
183
  nc.is_my_type(42) # True
@@ -168,24 +190,28 @@ nc.get_true_properties(42) # [..., 'my_type', ...]
168
190
 
169
191
  | Function | Description |
170
192
  |---|---|
171
- | `is_prime(n)` | Returns `True` if `n` is a standard prime |
172
- | `is_armstrong(n)` | Returns `True` if `n` is a narcissistic/Armstrong number |
173
- | `get_all_properties(n)` | Dict of every registered type `True`/`False` |
174
- | `get_true_properties(n)` | List of only the properties that are `True` |
193
+ | `classify(n)` | Returns a dict with the number, its true properties, and a score |
194
+ | `classify_batch(numbers)` | Classify a list of numbers; returns a list of dicts |
195
+ | `random_number(max_n)` | Classify a randomly selected number up to `max_n` |
196
+ | `find_by_property(start, end, **filters)` | Find numbers in a range matching given property filters |
197
+ | `stream(start, end)` | Generator yielding classify results one at a time; memory-safe |
198
+ | `is_prime(n)` | Returns `True` if `n` is prime |
199
+ | `is_armstrong(n)` | Returns `True` if `n` is an Armstrong (narcissistic) number |
200
+ | `get_all_properties(n)` | Dict mapping every registered type to `True` or `False` |
201
+ | `get_true_properties(n)` | List of only the properties that hold for `n` |
175
202
  | `print_properties(n)` | Pretty-prints a formatted property table to stdout |
176
203
  | `find_in_range(fn, lo, hi)` | All integers in `[lo, hi]` where `fn` returns `True` |
177
- | `find_all_in_range(lo, hi)` | Dict mapping every number in range to its true properties |
178
- | `count_properties(n)` | Count of how many types apply to `n` |
179
- | `most_special_in_range(lo, hi)` | The number in `[lo, hi]` with the most true properties |
204
+ | `count_properties(n)` | Number of types that apply to `n` |
205
+ | `most_special_in_range(lo, hi)` | Number in `[lo, hi]` with the greatest count of true properties |
180
206
 
181
- Full API docs: [github.com/aratrikghosh2011-tech/numclassify](https://github.com/aratrikghosh2011-tech/numclassify)
207
+ Full API documentation: [github.com/aratrikghosh2011-tech/numclassify](https://github.com/aratrikghosh2011-tech/numclassify)
182
208
 
183
209
  ---
184
210
 
185
211
  ## Requirements
186
212
 
187
213
  - Python 3.8 or higher
188
- - Zero external dependencies
214
+ - No external dependencies
189
215
 
190
216
  ---
191
217
 
@@ -0,0 +1,25 @@
1
+ # API Reference
2
+
3
+ ## classify(n)
4
+ Returns dict with number, true_properties list, and score.
5
+
6
+ ## classify_batch(numbers)
7
+ Classify a list of integers.
8
+
9
+ ## random_number(max_n=10000)
10
+ Classify a random integer up to max_n.
11
+
12
+ ## find_by_property(start, end, **filters)
13
+ Find numbers matching property filters.
14
+
15
+ ## stream(start, end)
16
+ Memory-safe generator over large ranges.
17
+
18
+ ## Utilities
19
+ - get_all_properties(n)
20
+ - get_true_properties(n)
21
+ - print_properties(n)
22
+ - count_properties(n)
23
+ - most_special_in_range(lo, hi)
24
+ - find_in_range(fn, lo, hi)
25
+ - is_prime(n), is_armstrong(n), is_perfect(n)
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ See the full changelog on GitHub.
@@ -0,0 +1,22 @@
1
+ # CLI Reference
2
+
3
+ ## check
4
+ numclassify check 1729
5
+ numclassify check 1729 --json
6
+
7
+ ## compare
8
+ numclassify compare 6 28
9
+ numclassify compare 6 28 --json
10
+
11
+ ## find
12
+ numclassify find armstrong --limit 10
13
+
14
+ ## range
15
+ numclassify range 1 100 --filter prime
16
+
17
+ ## info
18
+ numclassify info armstrong
19
+
20
+ ## list
21
+ numclassify list
22
+ numclassify list --category primes
@@ -0,0 +1,23 @@
1
+ # numclassify
2
+
3
+ The most comprehensive Python number classification library - 3000+ types, zero dependencies.
4
+
5
+ ## Installation
6
+
7
+ pip install numclassify
8
+
9
+ ## Quick Start
10
+
11
+ import numclassify as nc
12
+ nc.classify(1729)
13
+ nc.classify_batch([6, 28, 496])
14
+ nc.find_by_property(start=1, end=1000, Perfect=True)
15
+ nc.random_number()
16
+
17
+ ## Why numclassify?
18
+
19
+ - 153: Armstrong, Narcissistic, Harshad, Triangular...
20
+ - 1729: Taxicab, Carmichael, Dodecagonal...
21
+ - 28: Perfect, Triangular, Hexagonal, Keith...
22
+
23
+ 3000+ named number types. Instant lookup. Zero dependencies.
@@ -0,0 +1,26 @@
1
+ site_name: numclassify
2
+ site_description: The most comprehensive Python number classification library - 3000+ types
3
+ site_url: https://aratrikghosh2011-tech.github.io/numclassify/
4
+ repo_url: https://github.com/aratrikghosh2011-tech/numclassify
5
+ repo_name: aratrikghosh2011-tech/numclassify
6
+
7
+ theme:
8
+ name: material
9
+ palette:
10
+ primary: indigo
11
+ accent: indigo
12
+ features:
13
+ - navigation.tabs
14
+ - navigation.top
15
+ - content.code.copy
16
+
17
+ nav:
18
+ - Home: index.md
19
+ - API Reference: api.md
20
+ - CLI: cli.md
21
+ - Changelog: changelog.md
22
+
23
+ markdown_extensions:
24
+ - pymdownx.highlight
25
+ - pymdownx.superfences
26
+ - tables