%I #32 Mar 14 2015 09:38:56
%S 1,12,123,1004,10005,100026,1000027,10000008,100000089,10000000010,
%T 100000000111,1000000000212,10000000000913,100000000000614,
%U 1000000000000215,10000000000000016,100000000000000517,1000000000000000818,10000000000000001719,100000000000000000020
%N Smallest multiple of n in which the string of digits of n occurs after (n-1) most significant digits.
%H Alois P. Heinz, <a href="/A079847/b079847.txt">Table of n, a(n) for n = 1..1000</a>
%F For n>1, let d be the number of digits in n, and n' = n/gcd(n,10^d). Then a(n) = (10^{n-2}+mod(-(10^{n-2}),n')) * 10^d + n. (The mod function used here always returns a nonnegative result; e.g., mod(-2,7) = 5.) - _Franklin T. Adams-Watters_, Jul 25 2014
%e a(4) = 1004, 4 occurs as the 4th digit from the left. a(10) = 10000000010. ('10') occurs after 9 digits.
%t a079847[n_] := 10^(n - 1 + Floor[Log10[n]]) + (NestWhile[# + 1 &, 0, Mod[10^(n - 1 + Floor[Log10[n]]) + # 10^(1 + Floor[Log10[n]]), n] != 0 &]) 10^(1 + Floor[Log10[n]]) + n; a079847[1] = 1; Table[a079847[n], {n, 20}] (* _L. Edson Jeffery_, Jul 16 2014 *)
%o (PARI) numdig(n)=my(r=1);while(n>=10,n\=10;r++);r
%o a(n) = my(k,m);if(n<=1,n,k=10^numdig(n);m=10^(n-2);(-m%(n\gcd(n,k))+m)*k+n) \\ _Franklin T. Adams-Watters_, Jul 25 2014
%Y Cf. A245470.
%K base,nonn
%O 1,2
%A _Amarnath Murthy_, Feb 18 2003
%E More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Jul 04 2003
|