Metadata-Version: 2.4
Name: HugeNats
Version: 0.1.0
Summary: Wrapper de int para numeros naturales grandes con slicing por bits
Author-email: nand0san <hancaidolosdos@hotmail.com>
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: license-file

# HugeNats

HugeNats es una clase `HugeNat` para representar numeros naturales grandes (ℕ₀) como un wrapper de `int`, con indexado y slicing por bits, mas utilidades compatibles con `int`.

## Instalacion

```bash
pip install HugeNats
```

## Uso rapido

```python
from hugenat import HugeNat
import numpy as np

x = HugeNat(123456789)

limbs = np.array([0xFFFFFFFFFFFFFFFF, 0x1], dtype=np.uint64)
y = HugeNat(limbs)

z = HugeNat([0, 1, 0, 2])
```

## Caracteristicas

- Solo naturales (incluye 0)
- Bit indexing y slicing por bits
- Metodos tipo `int`: `bit_length`, `bit_count`, `to_bytes`, `from_bytes`
- Vista de bits: `bits(order="msb->lsb" | "lsb->msb", length=None)`
- Nucleo Numba-friendly con `to_core()` y `from_core()`

## Bits e indexado

```python
x = HugeNat(0b1101101)

x[0]   # 1 (LSB)
x[-1]  # 1 (MSB)
x[100] # 0 (fuera de rango)

x[0:3]  # bits 0..2, recompactados
x[1:6:2]  # slicing con step arbitrario
```

## Numba (core)

```python
from numba import njit
from hugenat import HugeNat

@njit
def popcount_core(limbs, nbits):
    total = 0
    for i in range(limbs.size):
        total += int(limbs[i]).bit_count()
    return total

h = HugeNat(1234)
limbs, nbits = h.to_core()
popcount_core(limbs, nbits)
```

## Limbs

- 1D `uint64` little-endian por palabra
- `limbs[0]` contiene los bits 0..63
- Se recortan ceros lideres al final del array

## Licencia

MIT
