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

m
Added Easylang
m (→‎{{header|Wren}}: Minor tidy)
m (Added Easylang)
 
Line 492:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/First_power_of_2_that_has_leading_decimal_digits_of_12#Pascal Pascal].
 
=={{header|EasyLang}}==
{{trans|Java}}
<syntaxhighlight>
func p l n .
log = log10 2
factor = 1
loop = l
while loop > 10
factor *= 10
loop = loop div 10
.
while n > 0
test += 1
val = floor (factor * pow 10 (test * log mod 1))
if val = l
n -= 1
.
.
return test
.
proc test l n . .
print "p(" & l & ", " & n & ") = " & p l n
.
test 12 1
test 12 2
test 123 45
test 123 12345
test 123 678910
</syntaxhighlight>
{{out}}
<pre>
p(12, 1) = 7
p(12, 2) = 80
p(123, 45) = 12710
p(123, 12345) = 3510491
p(123, 678910) = 193060223
</pre>
 
=={{header|F_Sharp|F#}}==
Line 516 ⟶ 554:
Real: 00:00:10.140
</pre>
 
=={{header|Factor}}==
A translation of the first Pascal example:
1,983

edits