Talk:Two identical strings: Difference between revisions

(FreeBASIC black magic)
Line 76:
== FreeBASIC black magic ==
The [http://rosettacode.org/wiki/Two_identical_strings#FreeBASIC FreeBASIC solution] to this task is super neat! Any chance for an explanation as to how/why it works? --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 12:48, 3 April 2021 (UTC)
:log n/log 2 is the number of bits - 1 representing n in binary. The formula produces n shifted left by this number + 1, then adds n.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 15:24, 3 April 2021 (UTC)
2,171

edits