cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A046519 Least n-digit 'happy' prime.

This page as a plain text file.
%I A046519 #19 Feb 16 2025 08:32:39
%S A046519 7,13,103,1009,10009,100003,1000003,10000121,100000039,1000000009,
%T A046519 10000000033,100000000003,1000000000039,10000000000411,
%U A046519 100000000000067,1000000000000487,10000000000000481,100000000000000003
%N A046519 Least n-digit 'happy' prime.
%C A046519 Values found by Harvey Heinz and _Jud McCranie_.
%D A046519 R. K. Guy, Unsolved Problems Number Theory, Sect. E34.
%H A046519 Bo Gyu Jeong, <a href="/A046519/b046519.txt">Table of n, a(n) for n = 1..50</a>
%H A046519 C. Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_021.htm">Related puzzle page</a>
%H A046519 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/HappyNumber.html">Happy Number</a>
%o A046519 (Python)
%o A046519 from sympy import nextprime
%o A046519 def A046519(n):
%o A046519     m = 10**(n-1)
%o A046519     while (m:=nextprime(m)):
%o A046519         k = m
%o A046519         while k not in {1,37,58,89,145,42,20,4,16}:
%o A046519             k = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(k))
%o A046519         if k == 1:
%o A046519             return m # _Chai Wah Wu_, Aug 02 2023
%Y A046519 Cf. A007770, A035497.
%K A046519 nonn,base
%O A046519 1,1
%A A046519 _Patrick De Geest_, Sep 15 1998