OFFSET
1,2
COMMENTS
a(n) > 0 if and only if n is in A002473.
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
EXAMPLE
n=2,10,50,250 gives a(n)=2,25,255,2555; n=11,39,78, etc..a(n)=0.
10000 = 2 * 5 * 5 * 5 * 5 * 8. No product of two of these factors is less than 10 so a(10000) = 255558 (the concatenation of these factors in nondecreasing order). - David A. Corneth, Jul 31 2017
MATHEMATICA
f[x_] := Apply[Times, IntegerDigits[x]] a = Table[0, {256} ]; Do[ b = f[n]; If[b < 257 && a[[b]] == 0, a[[b]] =n], {n, 1, 10000} ]; a
PROG
(PARI) a(n) = {if(n==1, return(1)); my(res = []); forstep(i=9, 2, -1, v = valuation(n, i); if(v > 0, res = concat(vector(v, j, i), res); n/=i^v)); if(n==1, fromdigits(res), 0)} \\ David A. Corneth, Jul 31 2017
(Python)
def convert(n):
if n == 1:
return 1
result = 0
cur = 1
while n > 1:
found = False
for i in range(9, 1, -1):
if n % i == 0:
result += cur * i
cur *= 10
n //= i
found = True
break
if not found:
return 0
return result
N = 256
for n in range(1, N):
print(n, convert(n))
# Dmitry Kamenetsky, Oct 20 2008
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Labos Elemer, Feb 19 2002
STATUS
approved