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.

A037065 Smallest prime containing exactly n 6's.

This page as a plain text file.
%I A037065 #16 Jul 21 2025 00:22:37
%S A037065 2,61,661,6661,166667,666667,16666669,66666667,666666667,6666666661,
%T A037065 66666666667,1666666666661,36666666666661,166666666666667,
%U A037065 3666666666666667,16666666666666661,616666666666666661,666666666666666661,36666666666666666661,66666666666666666667
%N A037065 Smallest prime containing exactly n 6's.
%C A037065 Note that a(11) is palindromic.
%C A037065 The last digit of n cannot be 6, therefore a(n) must have at least n+1 digits. It is probable that none among [10^n/9]*60 + {1,3,7,9} is prime in which case a(n) must have n+2 digits. We conjecture that for all n >= 0, a(n) equals [10^(n+1)/9]*60 + b with 1 <= b <= 9 and one of the (first) digits 6 replaced by a digit among {0, 1, 2, 3, 4, 5}. - _M. F. Hasler_, Feb 22 2016
%H A037065 M. F. Hasler, <a href="/A037065/b037065.txt">Table of n, a(n) for n = 0..200</a>
%F A037065 a(n) = prime(A037064(n)). - _Amiram Eldar_, Jul 21 2025
%t A037065 f[n_, b_] := Block[{k = 10^(n + 1), p = Permutations[ Join[ Table[b, {i, 1, n}], {x}]], c = Complement[Table[j, {j, 0, 9}], {b}], q = {}}, Do[q = Append[q, Replace[p, x -> c[[i]], 2]], {i, 1, 9}]; r = Min[ Select[ FromDigits /@ Flatten[q, 1], PrimeQ[ # ] & ]]; If[r ? Infinity, r, p = Permutations[ Join[ Table[ b, {i, 1, n}], {x, y}]]; q = {}; Do[q = Append[q, Replace[p, {x -> c[[i]], y -> c[[j]]}, 2]], {i, 1, 9}, {j, 1, 9}]; Min[ Select[ FromDigits /@ Flatten[q, 1], PrimeQ[ # ] & ]]]]; Table[ f[n, 6], {n, 1, 17}]
%o A037065 (PARI) A037065(n)={my(p, t=10^(n+1)\9*60); forvec(v=[[-1, n], [-6, -1]], nextprime(p=t+10^(n-v[1])*v[2])-p<10 && return(nextprime(p)))} \\ _M. F. Hasler_, Feb 22 2016
%Y A037065 Cf. A065589, A037064, A034388, A036507-A036536.
%Y A037065 Cf. A037053, A037055, A037057, A037059, A037061, A037063, A037067, A037069, A037071.
%K A037065 nonn,base
%O A037065 0,1
%A A037065 _Patrick De Geest_, Jan 04 1999
%E A037065 More terms from _Hans Havermann_, Jun 16 2001
%E A037065 More terms and a(0) = 2 from _M. F. Hasler_, Feb 22 2016