First power of 2 that has leading decimal digits of 12: Difference between revisions

m
No edit summary
Line 283:
calc = do
raised <- [-1 ..]
let firstDigits = floor $ 10 ** (snd (properFraction $ log10pwr * realToFrac raised) + realToFrac digitCount)
+ 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.
Anonymous user