Vai al contenuto
🛠️ToolsShed

Narcissistic Number Checker

Controlla se un numero è narcisistico (numero di Armstrong) e trova tutti i numeri narcisistici fino a un limite.

Trova tutti i numeri narcisistici fino a

Che cosa è un numero narcisistico?

A narcissistic number (Armstrong number) equals the sum of its digits each raised to the power of the digit count. Example: 153 = 1^3 + 5^3 + 3^3 = 153.

Informazioni sullo strumento

Un numero narcisistico (anche chiamato numero di Armstrong) è un numero che è uguale alla somma delle sue stesse cifre, ciascuna elevata alla potenza del numero di cifre. Ad esempio, 153 è narcisistico perché 1³ + 5³ + 3³ = 153. Questi numeri sono curiosità matematiche affascinanti che appaiono raramente nel sistema numerico, rendendoli divertenti da esplorare e comprendere.

Per utilizzare questo verificatore, basta inserire qualsiasi numero intero positivo e lo strumento determinerà istantaneamente se è narcisistico. Il calcolo viene eseguito completamente nel tuo browser, quindi non è necessario creare un account o preoccuparsi della tua privacy. Funziona con numeri piccoli come 9 e anche con numeri più grandi, aiutandoti a verificare rapidamente le proprietà matematiche.

I numeri narcisistici sono apprezzati da appassionati di matematica, studenti che imparano la teoria dei numeri e programmatori che esplorano la matematica computazionale. L'elenco completo dei numeri narcisistici è finito e ben documentato, rendendo questo strumento utile per la verifica e l'esplorazione educativa dei modelli matematici.

Domande Frequenti

Implementazione del Codice

def is_narcissistic(n: int) -> bool:
    """Check if n is a narcissistic (Armstrong) number."""
    digits = str(n)
    power = len(digits)
    return sum(int(d) ** power for d in digits) == n

def find_narcissistic(limit: int) -> list[int]:
    """Find all narcissistic numbers up to limit."""
    return [n for n in range(limit + 1) if is_narcissistic(n)]

# Check specific numbers
for n in [153, 370, 371, 407, 1634, 9474]:
    digits = [int(d) for d in str(n)]
    power = len(str(n))
    breakdown = " + ".join(f"{d}^{power}" for d in digits)
    result = sum(d ** power for d in digits)
    print(f"{n}: {breakdown} = {result} {'✓' if result == n else '✗'}")

# Find all up to 10000
print("\nAll narcissistic numbers up to 10000:")
print(find_narcissistic(10000))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.