Anonymous user
First power of 2 that has leading decimal digits of 12: Difference between revisions
First power of 2 that has leading decimal digits of 12 (view source)
Revision as of 19:02, 21 May 2020
, 4 years ago→{{header|Haskell}}
No edit summary |
|||
Line 283:
calc = do
raised <- [-1 ..]
let firstDigits = floor $ 10 ** (snd (properFraction $ log10pwr * realToFrac raised)
+ realToFrac digitCount)
guard (firstDigits == l)
[raised]
Line 296 ⟶ 297:
p(123, 12345) = 3510491
p(123, 678910) = 193060223</pre>
=={{header|J}}==
Modeled on the python version. Depending on the part of speech defined, the variable names x, y, u, v, m, and n can have special meaning within explicit code. They are defined by the arguments. In the fonts I usually use, lower case "l" is troublesome as well.
|