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.

A065588 Smallest prime beginning with exactly n 5's.

This page as a plain text file.
%I A065588 #23 Mar 03 2021 02:59:08
%S A065588 2,5,557,5557,555521,555557,55555517,55555553,5555555501,5555555557,
%T A065588 5555555555057,555555555551,5555555555551,555555555555529,
%U A065588 555555555555557,55555555555555519,5555555555555555021,555555555555555559,55555555555555555567,5555555555555555555087
%N A065588 Smallest prime beginning with exactly n 5's.
%H A065588 Michael S. Branicky, <a href="/A065588/b065588.txt">Table of n, a(n) for n = 0..997</a> (terms 0..200 from M. F. Hasler)
%o A065588 (Python)
%o A065588 from sympy import isprime
%o A065588 def a(n):
%o A065588   if n < 2: return list([2, 5])[n]
%o A065588   n5s, i, pow10, end_digits = int('5'*n), 1, 1, 0
%o A065588   while True:
%o A065588     i = 1
%o A065588     while i < pow10:
%o A065588       istr = str(i)
%o A065588       if istr[0] == '5' and len(istr) == end_digits:
%o A065588         i += 2 if pow10 <= 10 else pow10 // 10
%o A065588       else:
%o A065588         t = n5s * pow10 + i
%o A065588         if isprime(t): return t
%o A065588         i += 2
%o A065588     pow10 *= 10; end_digits += 1
%o A065588 print([a(n) for n in range(20)]) # _Michael S. Branicky_, Feb 05 2021, corrected Mar 03 2021
%Y A065588 Cf. A037063, A065584 - A065592. Different from A068105.
%K A065588 nonn,base
%O A065588 0,1
%A A065588 _Robert G. Wilson v_, Nov 28 2001
%E A065588 Corrected by _N. J. A. Sloane_, Jan 11 2007 and by _Don Reble_, Jan 17 2007
%E A065588 Offset corrected by _Michael S. Branicky_, Feb 05 2021