A241019 a(n) is the smallest j such that the n-digit number consisting of a 1 in position j and 3's in the other n-1 positions is a prime, or 0 if no such prime exists.
1, 2, 3, 2, 2, 4, 2, 6, 5, 5, 5, 0, 3, 8, 1, 11, 7, 6, 4, 5, 11, 5, 0, 0, 9, 11, 0, 5, 5, 0, 4, 5, 17, 19, 19, 6, 0, 3, 9, 35, 1, 27, 24, 32, 0, 36, 14, 11, 34, 14, 22, 0, 17, 53, 0, 47, 11, 0, 16, 3, 0, 15, 0, 39, 22, 40, 27, 39, 0, 19, 2, 19, 48, 2, 43, 19
Offset: 2
Links
- Robert Israel, Table of n, a(n) for n = 2..4001
Programs
-
Maple
with(numtheory):nn:=80:T:=array(1..nn): for n from 2 to nn do: for i from 1 to n do: T[i]:=3: od: ii:=0: for j from 1 to n while(ii=0)do: T[j]:=1:s:=sum('T[i]*10^(n-i)', 'i'=1..n): if type(s,prime)=true then ii:=1: printf(`%d, `,j): else T[j]:=3: fi: od: if ii=0 then printf(`%d, `,0): else fi: od:
-
Python
from sympy import isprime def a(n): base = (10**n-1)//9*3 for j in range(1, n+1): t = base - 2*10**(n-j) if isprime(t): return j return 0 print([a(n) for n in range(2, 78)]) # Michael S. Branicky, Jun 02 2024
Extensions
Name simplified and offset corrected by Michael S. Branicky, Jun 02 2024
Comments