%I #7 Jul 31 2015 01:14:27
%S 1,1,3,7,4,1,1,3,2,9,0,91,23,77,0,0,11,53,0,79,0,81,0,87,24,1,0,63,17,
%T 69,0,71,18,97,0,0,16,73,0,59,0,61,0,7,4,0,0,83,12,49,0,51,13,17,0,0,
%U 21,93,0,39,0,41,0,27,9,0,0,3,7,29,0,31,8,37,0,3,1,13,0,19,0,21,0,47,14,0
%N Least positive k such that k * n^2 ends with n, or 0 no such k exists.
%e a(3) = 7 because 7 * 3^2 = 63, which ends with "3".
%e a(11) = 91 because 91 * 11^2 = 11011 which ends with "11".
%e a(22) = 0 because there is no "k" such that k*22^2 ends with 22.
%t f[n_] := Block[{k = 1, n2 = n^2, m = Max[10^Floor[ Log[10, n] + 1], 10]}, While[k < 10^4 && Mod[k*n2, m] != n, k++ ]; If[k == 10^4, 0, k]]; Table[ f[n], {n, 85}] (* _Robert G. Wilson v_, Jul 02 2005 *)
%K nonn,base
%O 0,3
%A _Luca Colucci_, Jun 29 2005
%E Edited and extended by _Robert G. Wilson v_, Jul 02 2005
|