login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(1) and a(3) are 0. For all other n, a(n) is the smallest k such that 10*k is adjacent to a multiple of the n-th prime.
0

%I #19 Apr 30 2013 14:42:30

%S 0,1,0,2,1,4,5,2,7,3,3,11,4,13,14,16,6,6,20,7,22,8,25,9,29,10,31,32,

%T 11,34,38,13,41,14,15,15,47,49,50,52,18,18,19,58,59,20,21,67,68,23,70,

%U 24,24,25,77,79,27,27,83,28,85,88,92,31,94,95,33,101

%N a(1) and a(3) are 0. For all other n, a(n) is the smallest k such that 10*k is adjacent to a multiple of the n-th prime.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Divisibility_rule">Divisibility rule</a>

%e a(6) = 4 because 13 (the sixth prime) divides 39, which is adjacent to 40.

%t a[n_] := Block[{p = Prime[n], k = 0}, Mod[10, p] > 0 && While[! MemberQ[{1, p-1}, Mod[10*k, p]], k++]; k]; Array[a,68] (* _Giovanni Resta_, Apr 30 2013 *)

%K nonn

%O 1,4

%A _J. Lowell_, Apr 23 2013

%E a(20)-a(68) from _Giovanni Resta_, Apr 30 2013