Course of Raku / Advanced / More about built-in types / Integers / Exercises / How many digits
Solution: How many digits
Here is a possible solution to the task.
Code
say (2 ** 1000).chars;🦋 You can find the source code in the file big-factorial.raku.
Output
302Comments
2 ** 1000is computed exactly: Raku does not round it or overflow, because integers have arbitrary precision.charsis normally a string method, but calling it on an integer first turns the number into its decimal text and then counts the characters. As there are neither minus sign nor decimal point here, that character count is exactly the number of digits —302.