login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A321288
a(n) is the unique n-digit odd number (including leading zero(s)) with alternating even and odd digits and divisible by 5^n.
1
5, 25, 125, 8125, 78125, 78125, 5078125, 5078125, 705078125, 2705078125, 72705078125, 272705078125, 3272705078125, 23272705078125, 323272705078125, 4323272705078125, 74323272705078125, 474323272705078125, 1474323272705078125, 61474323272705078125, 561474323272705078125
OFFSET
1,1
COMMENTS
For n > 1, if n is even, then a(n) is the unique number in {a(n-1), a(n-1) + 2*10^(n-1), a(n-1) + 4*10^(n-1), a(n-1) + 6*10^(n-1), a(n-1) + 8*10^(n-1)} that divides 5^n; if n is odd, then a(n) is the unique number in {a(n-1) + 10^(n-1), a(n-1) + 3*10^(n-1), a(n-1) + 5*10^(n-1), a(n-1) + 7*10^(n-1), a(n-1) + 9*10^(n-1)} that divides 5^n.
The unique n-digit even number (including leading zero(s)) with alternating even and odd digits and divisible by 5^n is 0 if n = 1 and 10*a(n-1) if n > 1. - Jianing Song, Feb 24 2021
FORMULA
a(n) = Sum_{i=0..n-1} A321289(i)*10^i.
EXAMPLE
a(2) is the unique number in {5, 25, 45, 65, 85} that is divisible by 25, which is 25.
a(3) is the unique number in {125, 325, 525, 725, 925} that is divisible by 125, which is 125.
a(4) is the unique number in {125, 2125, 4125, 6125, 8125} that is divisible by 625, which is 8125.
a(5) is the unique number in {18125, 38125, 58125, 78125, 98125} that is divisible by 3125, which is 78125.
MATHEMATICA
n = 21; a[1] = 5; For[i=2, i <= n, i++, For[j=0, j <= 4, j++, t = a[i-1] + (2j + Mod[i, 2]) 10^(i-1); If[Mod[t, 5^i] == 0, a[i] = t; Break[]]]]; Array[a, n] (* Jean-François Alcover, Nov 23 2018, from PARI *)
PROG
(PARI) seq(n)={my(v=vector(n)); v[1]=5; for(i=2, n, for(j=0, 4, my(t=v[i-1] + (2*j + i%2)*10^(i-1)); if(t%(5^i)==0, v[i]=t; break))); v}
a(n) = seq(n)[n] \\ Program provided by Andrew Howroyd
CROSSREFS
Cf. A321289.
Sequence in context: A140288 A306570 A061835 * A030988 A173260 A080516
KEYWORD
nonn,base
AUTHOR
Jianing Song, Nov 02 2018
STATUS
approved