The point I'm trying to make is if something is under a copyleft license, you can't copy and paste it verbatim to something non-copyleft. It's what the license says.
Also, to be pedantic, the function I'm commenting on is pure maths, and you can't license/patent mathematics.
On the other hand, if there's some magic sauce of doing something, let it be 25 lines, what will you say? It's just 25 lines, so you can't license it? To be more pedantic, I actually have an algorithm, which is around 25 lines and does something novel. I've published a paper on it.
If I license the reference implementation with AGPLv3+, and you use it and close it, and if I can't go after you, what's the purpose of the license?
You can read the paper and try to implement it. It's free in that regard.