A079847 Smallest multiple of n in which the string of digits of n occurs after (n-1) most significant digits.
1, 12, 123, 1004, 10005, 100026, 1000027, 10000008, 100000089, 10000000010, 100000000111, 1000000000212, 10000000000913, 100000000000614, 1000000000000215, 10000000000000016, 100000000000000517, 1000000000000000818, 10000000000000001719, 100000000000000000020
Offset: 1
Examples
a(4) = 1004, 4 occurs as the 4th digit from the left. a(10) = 10000000010. ('10') occurs after 9 digits.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..1000
Crossrefs
Cf. A245470.
Programs
-
Mathematica
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 *)
-
PARI
numdig(n)=my(r=1);while(n>=10,n\=10;r++);r 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
Formula
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
Extensions
More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Jul 04 2003