login
A079847
Smallest multiple of n in which the string of digits of n occurs after (n-1) most significant digits.
2
1, 12, 123, 1004, 10005, 100026, 1000027, 10000008, 100000089, 10000000010, 100000000111, 1000000000212, 10000000000913, 100000000000614, 1000000000000215, 10000000000000016, 100000000000000517, 1000000000000000818, 10000000000000001719, 100000000000000000020
OFFSET
1,2
LINKS
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
EXAMPLE
a(4) = 1004, 4 occurs as the 4th digit from the left. a(10) = 10000000010. ('10') occurs after 9 digits.
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 *)
PROG
(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
CROSSREFS
Cf. A245470.
Sequence in context: A001703 A127422 A278983 * A144165 A113572 A037701
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Feb 18 2003
EXTENSIONS
More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Jul 04 2003
STATUS
approved