OFFSET
1,2
COMMENTS
Numbers n such that product of digits of n is a power of 5.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..8190
FORMULA
From Robert Israel, Aug 22 2016: (Start)
a(2n+1) = 10 a(n) + 1.
a(2n+2) = 10 a(n) + 5.
G.f. g(x) satisfies g(x) = 10 (x + x^2) g(x^2) + (x + 5 x^2)/(1 - x^2). (End)
EXAMPLE
5551 is in the sequence because all of its digits are 1 or 5 and consequently because the product of digits, 5*5*5*1 = 125 = 5^3 is a power of 5.
MAPLE
S[0]:= [0]:
for d from 1 to 6 do S[d]:= map(t -> (10*t+1, 10*t+5), S[d-1]) od:
seq(op(S[d]), d=1..6); # Robert Israel, Aug 22 2016
MATHEMATICA
Select[Range[20000], IntegerQ[Log[5, Times@@(IntegerDigits[#])]]&]
PROG
(Python)
from itertools import product
A276037_list = [int(''.join(d)) for l in range(1, 10) for d in product('15', repeat=l)] # Chai Wah Wu, Aug 18 2016
(Magma) [n: n in [1..20000] | Set(Intseq(n)) subset {1, 5}]; // Vincenzo Librandi, Aug 19 2016
(PARI) a(n) = my(v=[1, 5], b=binary(n+1), d=vector(#b-1, i, v[b[i+1]+1])); sum(i=1, #d, d[i] * 10^(#d-i)) \\ David A. Corneth, Aug 22 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Vincenzo Librandi, Aug 17 2016
EXTENSIONS
Example changed by David A. Corneth, Aug 22 2016
STATUS
approved