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.

A037067 Smallest prime containing exactly n 7's.

This page as a plain text file.
%I A037067 #23 Jul 21 2025 00:22:44
%S A037067 2,7,277,1777,47777,727777,7477777,77767777,577777777,1777777777,
%T A037067 67777777777,377777777777,7177777777777,17777777777777,
%U A037067 577777777777777,2777777777777777,77777767777777777,377777777777777777,2777777777777777777,71777777777777777777
%N A037067 Smallest prime containing exactly n 7's.
%C A037067 We conjecture that for all n >= 2, a(n) equals floor(10^(n+1)/9)*7 with one of the (first) digits 7 replaced by a digit among {0, ..., 6}. - _M. F. Hasler_, Feb 22 2016
%C A037067 The conjecture is false: a(668) = 7*(10^669-1)/9 + 10^276. - _Robert Israel_, Jul 13 2016
%H A037067 M. F. Hasler and Robert Israel, <a href="/A037067/b037067.txt">Table of n, a(n) for n = 0..998</a> (n = 0..200 from M. F. Hasler)
%F A037067 a(n) = prime(A037066(n)). - _Amiram Eldar_, Jul 21 2025
%p A037067 F:= proc(n) local x0,i,j;
%p A037067   x0:= 7/9*(10^(n+1)-1);
%p A037067   for j from 1 to 6 do
%p A037067     if isprime(x0 + (j-7)*10^n) then
%p A037067       return x0 + (j-7)*10^n fi od;
%p A037067   for i from n-1 to 0 by -1 do
%p A037067     for j from 0 to 6 do
%p A037067      if isprime(x0 + (j-7)*10^i) then
%p A037067        return x0 + (j-7)*10^i fi od od;
%p A037067   for i from 0 to n do
%p A037067     for j from 8 to 9 do
%p A037067        if isprime(x0 + (j-7)*10^i) then
%p A037067          return x0 + (j-7)*10^i fi
%p A037067   od od:
%p A037067 end proc:
%p A037067 F(0):= 2: F(1):= 7:
%p A037067 map(F, [$0..100]); # _Robert Israel_, Jul 13 2016
%t A037067 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, 7], {n, 1, 18}]
%o A037067 (PARI) A037067(n)={my(t=10^(n+1)\9*7); forvec(v=[[-1, n], [-7, -1]], ispseudoprime(p=t+10^(n-v[1])*v[2]) && return(p)); error} \\ _M. F. Hasler_, Feb 22 2016
%Y A037067 Cf. A065590, A065581, A037066, A034388, A036507-A036536.
%Y A037067 Cf. A037053, A037055, A037057, A037059, A037061, A037063, A037065, A037069, A037071.
%K A037067 nonn,base
%O A037067 0,1
%A A037067 _Patrick De Geest_, Jan 04 1999
%E A037067 More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Mar 23 2003
%E A037067 More terms from and a(0) = 2 prepended by _M. F. Hasler_, Feb 22 2016