Great, I hope the twice is relative to $powmod's prior speed not the new, lol. The big integer function should be able to do this well below 500 ticks, but hopefully this will be fast enough to make it usable in more situations.

Your reply reminded me that I was still using (base * base) inside both variants of bf_modpow, because in the earlier beta the ^ operator wasn't working right. I'd forgotten to change that alias to use (base ^2) now that it's fixed, so now when I make just that 1 change in the alias, that original 2048-bit //command consistently reduces from 4360 down to 4140 ticks, which reduces the time to 95%.

Based on your mention of $isodd, I tested to see the effect of changing the if() in my loop. bf_modpow2 can't use it because it changed to see if the byte in &temp was 49, so there's 3 alternative ways for the if() to check if the lowest bit is odd:

old:: if ($calc(%exponent.bf % 2))
new1: if (2 \\ %exponent.bf)
new2: if ($right(%exponent.bf,1) isin 13579)
new3: if (%exponent.bf & 1)

When I changed from 'old' to 'new1', the time was smaller by maybe 5-10 ticks, but is within the margin of error, and is probably doing the same thing under the hood as calc % 2 does.

Doing the string compare in 'new2' was faster by 40-50 ticks, for a good 1% gain above 'old'.

I can't test 'new3' because it turned out that the '&' operator refuses to leave the 2^32 range of doubles mode. The test below returns 100% $true for (term1 & 1) as 2^32 and above, and 100% false for (term1 !& 1), and editing the 33 will verify the fix works for really big numbers too.

//var %i 1000 , %bits 33 , %min.bf 2 ^ $calc(%bits -1), %max.bf 2 ^ %bits , %count1 0 , %count2 0 | while (%i) { var %rand.bf $r(%min.bf,%max.bf) | if (%rand.bf & 1) inc %count1 | if ($right(%rand.bf,1) isin 13579) inc %count2 | dec %I } | echo -a bits %bits : count rand & 1: %count1 : count right(,1) isin 13579 : %count2