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

%I #18 Aug 02 2023 16:43:36

%S 7,13,103,1009,10009,100003,1000003,10000121,100000039,1000000009,

%T 10000000033,100000000003,1000000000039,10000000000411,

%U 100000000000067,1000000000000487,10000000000000481,100000000000000003

%N Least n-digit 'happy' prime.

%C Values found by Harvey Heinz and _Jud McCranie_.

%D R. K. Guy, Unsolved Problems Number Theory, Sect. E34.

%H Bo Gyu Jeong, <a href="/A046519/b046519.txt">Table of n, a(n) for n = 1..50</a>

%H C. Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_021.htm">Related puzzle page</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/HappyNumber.html">Happy Number</a>

%o (Python)

%o from sympy import nextprime

%o def A046519(n):

%o m = 10**(n-1)

%o while (m:=nextprime(m)):

%o k = m

%o while k not in {1,37,58,89,145,42,20,4,16}:

%o k = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(k))

%o if k == 1:

%o return m # _Chai Wah Wu_, Aug 02 2023

%Y Cf. A007770, A035497.

%K nonn,base

%O 1,1

%A _Patrick De Geest_, Sep 15 1998

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 April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)