%I #10 Oct 02 2024 12:32:06
%S 2,21,711,240111,51111,45411111,16059111111,43761111111,2121411111111,
%T 328203111111111,11862441111111111,37253511111111111,
%U 10630644111111111111,141896571111111111111,17806995411111111111111,9675948111111111111111,11187474501111111111111111,235460890911111111111111111
%N a(n) is the first number that is a prime times 3^n and ends in exactly n 1's.
%H Robert Israel, <a href="/A376689/b376689.txt">Table of n, a(n) for n = 0..672</a>
%e a(3) = 240111 because 240111 = 3^3 * 8893 with 8893 prime and 240111 ends with three 1's.
%e a(12) = 10630644111111111111, not 3721911111111111111, because although 3721911111111111111 = 3^12 * 7003432386871 with 7003432386871 prime, 3721911111111111111 ends in 14 1's rather than just 12.
%p f:= proc(n) local x0,p;
%p x0:= -(1-10^(-n))/9 mod 3^n;
%p for p from x0*10^n+(10^n-1)/9 by 30^n do if isprime(p/3^n) and p mod 10^(n+1) <> (10^(n+1)-1)/9 then return p fi od
%p end proc;
%p map(f, [$0..20]);
%Y Cf. A065821.
%K nonn,base
%O 0,1
%A _Robert Israel_, Oct 01 2024