OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
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
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