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.
%I A241019 #15 Jun 04 2024 01:31:36 %S A241019 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, %T A241019 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, %U A241019 16,3,0,15,0,39,22,40,27,39,0,19,2,19,48,2,43,19 %N 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. %C A241019 Previous name: Let x(1)x(2)... x(n) denote the decimal expansion of a number p having an index j such that x(j) = 1 and x(i) = 3 for i <> j. The sequence lists the smallest index j such that p is prime, or 0 if no such prime exists. %C A241019 Except 0, the corresponding primes are 13, 313, 3313, 31333, 313333, 3331333, 31333333, 333331333, 3333133333, 33331333333, 333313333333, 0, 33133333333333, ... . %H A241019 Robert Israel, <a href="/A241019/b241019.txt">Table of n, a(n) for n = 2..4001</a> %p A241019 with(numtheory):nn:=80:T:=array(1..nn): %p A241019 for n from 2 to nn do: %p A241019 for i from 1 to n do: %p A241019 T[i]:=3: %p A241019 od: %p A241019 ii:=0: %p A241019 for j from 1 to n while(ii=0)do: %p A241019 T[j]:=1:s:=sum('T[i]*10^(n-i)', 'i'=1..n): %p A241019 if type(s,prime)=true %p A241019 then %p A241019 ii:=1: printf(`%d, `,j): %p A241019 else %p A241019 T[j]:=3: %p A241019 fi: %p A241019 od: %p A241019 if ii=0 %p A241019 then %p A241019 printf(`%d, `,0): %p A241019 else %p A241019 fi: %p A241019 od: %o A241019 (Python) %o A241019 from sympy import isprime %o A241019 def a(n): %o A241019 base = (10**n-1)//9*3 %o A241019 for j in range(1, n+1): %o A241019 t = base - 2*10**(n-j) %o A241019 if isprime(t): %o A241019 return j %o A241019 return 0 %o A241019 print([a(n) for n in range(2, 78)]) # _Michael S. Branicky_, Jun 02 2024 %Y A241019 Cf. A241018, A241020. %K A241019 nonn,base %O A241019 2,2 %A A241019 _Michel Lagneau_, Apr 15 2014 %E A241019 Name simplified and offset corrected by _Michael S. Branicky_, Jun 02 2024