Rebol is an interesting language...it's advertising scheme revolves around the fact that it is a very fast, very small (the compiler is <1 MB), and yet very powerful language...and though I didn't need to use too much of the arguable 'power' (most of which involves its capabilities for large-scale programs, including GUI stuff), it seems like a nice enough language, once you get past some of the odd syntax (everything is in square brackets, "either" replaces if-else, functions can be declared in multiple ways, though I still only understand the 'func' identifier (which is in some ways different from 'does')). Anyway, here is a solution, runs in about 20ms on my machine:
log-10: func [x] [return (log-e x) / (log-e 10)]
ans: 0
j: 1
b: 1
while [b < 10] [
i: b
while [i < 10] [
digs: 1 + (to integer! (j * log-10 (i)))
either digs = j [
ans: ans + 1
] [
b: i + 1
]
i: i + 1
]
j: j + 1
]
print ans
No comments:
Post a Comment