login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A046519 Least n-digit 'happy' prime. 5
7, 13, 103, 1009, 10009, 100003, 1000003, 10000121, 100000039, 1000000009, 10000000033, 100000000003, 1000000000039, 10000000000411, 100000000000067, 1000000000000487, 10000000000000481, 100000000000000003 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Values found by Harvey Heinz and Jud McCranie.
REFERENCES
R. K. Guy, Unsolved Problems Number Theory, Sect. E34.
LINKS
Eric Weisstein's World of Mathematics, Happy Number
PROG
(Python)
from sympy import nextprime
def A046519(n):
m = 10**(n-1)
while (m:=nextprime(m)):
k = m
while k not in {1, 37, 58, 89, 145, 42, 20, 4, 16}:
k = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(k))
if k == 1:
return m # Chai Wah Wu, Aug 02 2023
CROSSREFS
Sequence in context: A136720 A323468 A035030 * A283920 A128351 A192894
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Sep 15 1998
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 6 18:59 EDT 2024. Contains 372297 sequences. (Running on oeis4.)