Metadata-Version: 2.4
Name: krishnamurthy-utils
Version: 0.1.0
Summary: A lightweight Python package to check whether a number is a Krishnamurthy (Strong) number.
Author: Devidutta Das
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/devidutta3/krishnamurthy-utils
Project-URL: Repository, https://github.com/devidutta3/krishnamurthy-utils
Project-URL: Issues, https://github.com/devidutta3/krishnamurthy-utils/issues
Keywords: krishnamurthy,strong-number,peterson-number,factorial,math,python
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: license-file

# Krishnamurthy Utils

A lightweight, beginner-friendly, and efficient Python package for checking whether a number is a **Krishnamurthy Number** (also known as a **Strong Number** or **Peterson Number**).

The package provides a simple API that can be integrated into educational projects, coding practice, mathematical applications, and Python programs.

---

# What is a Krishnamurthy Number?

A **Krishnamurthy Number** is a positive integer whose value is equal to the sum of the factorials of its individual digits.

### Formula

Number = Σ Factorial(each digit)

For example,

**145**

```
1! + 4! + 5!
= 1 + 24 + 120
= 145
```

Since the sum equals the original number, **145 is a Krishnamurthy Number.**

Another example,

**40585**

```
4! + 0! + 5! + 8! + 5!
= 24 + 1 + 120 + 40320 + 120
= 40585
```

---

# Features

- Simple API
- Lightweight package
- Fast execution
- Beginner friendly
- Zero external dependencies
- Easy integration into any Python project
- Ideal for coding interviews and DSA practice
- Well documented

---

# Installation

Install directly from PyPI.

```bash
pip install krishnamurthy-utils
```

Or upgrade to the latest version.

```bash
pip install --upgrade krishnamurthy-utils
```

---

# Quick Start

```python
from krishnamurthy_utils import is_kmn

print(is_kmn(145))
```

Output

```
True
```

---

# Usage Examples

## Example 1

```python
from krishnamurthy_utils import is_kmn

print(is_kmn(145))
```

Output

```
True
```

---

## Example 2

```python
from krishnamurthy_utils import is_kmn

print(is_kmn(40585))
```

Output

```
True
```

---

## Example 3

```python
from krishnamurthy_utils import is_kmn

print(is_kmn(123))
```

Output

```
False
```

---

## Example 4

```python
from krishnamurthy_utils import is_kmn

numbers = [1, 2, 145, 40585, 123, 567]

for number in numbers:
    print(number, is_kmn(number))
```

Output

```
1 True
2 True
145 True
40585 True
123 False
567 False
```

---

# Function Reference

## is_kmn(number)

Checks whether the given integer is a Krishnamurthy Number.

### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| number | int | Positive integer |

### Returns

| Type | Description |
|------|-------------|
| bool | Returns `True` if the number is a Krishnamurthy Number, otherwise `False`. |

---

# Example

```python
from krishnamurthy_utils import is_kmn

number = int(input("Enter a number: "))

if is_kmn(number):
    print("Krishnamurthy Number")
else:
    print("Not a Krishnamurthy Number")
```

---

# Known Krishnamurthy Numbers

The known Krishnamurthy Numbers in decimal representation are

```
1
2
145
40585
```

---

# Time Complexity

```
Time Complexity : O(d)

Space Complexity : O(1)
```

Where **d** is the number of digits.

---

# Requirements

- Python 3.8+
- No external libraries required

---

# Project Structure

```
krishnamurthy-utils
│
├── src
│   └── krishnamurthy_utils
│       ├── __init__.py
│       └── krishnamurthy.py
│
├── tests
│   └── test_krishnamurthy.py
│
├── README.md
├── LICENSE
└── pyproject.toml
```

---

# Contributing

Contributions are welcome!

You can contribute by:

- Reporting bugs
- Improving documentation
- Adding test cases
- Optimizing the implementation
- Suggesting new features

Fork the repository, create a feature branch, and submit a pull request.

---

# License

This project is licensed under the **Apache License 2.0**.

You are free to use, modify, distribute, and contribute to this project under the terms of the Apache License 2.0.

See the `LICENSE` file for complete details.

---

# Author

**Krishna**

Engineer | Python Developer | AI & ML Enthusiast

---

# Support

If you find this package useful,

⭐ Star the repository

⭐ Share it with others

⭐ Contribute to its development

Happy Coding!
