This API takes a number and returns interesting mathematical properties about it, along with a fun fact.
- Determines if a number is prime
- Determines if a number is perfect
- Calculates various number properties (armstrong, odd/even)
- Provides digit sum
- Fetches fun facts about numbers
GET /api/classify-number?number=371
{
"number": 371,
"is_prime": false,
"is_perfect": false,
"properties": ["armstrong", "odd"],
"digit_sum": 11,
"fun_fact": "371 is an Armstrong number because 3^3 + 7^3 + 1^3 = 371"
}
{
"number": "alphabet",
"error": true
}
- Clone the repository
- Install dependencies:
npm install
- Start the server:
npm start
- Node.js
- Express
- TypeScript
- Axios (for external API calls)
Create a .env
file in the root directory with the following variables:
PORT=3000
ISC