Closed Reptorian1125 closed 1 year ago
it seems to work for me.
It's not working for me under Windows.
OK, that's because your macro concat_consec_digits_count(n)
returns a result that depends on variable tn
, which is not defined as a const
. Add const
before tn = ...
to makes it work:
eval "
const max_number = int(abs($1));
const base = int(abs($2));
const log_base = log(base);
logb(n) = log(n)/log_base;
concat_consec_digits_count(n) = n>=base?(
const tn = floor(logb(n));
n + (n + 1)*tn + (base*(1 - base^tn))/(base - 1)
):n;
const number_of_digits_in_concatenated_number = concat_consec_digits_count(max_number);"
Is there a reason why this problem shows up?
I'm pretty sure everything is a const.
EDIT: Oh, the additional ";". That's why.