![]() ![]() It was a brute-force primality test that tried each integer (both odd and even!) smaller than the square root of the number under test. I then asked it to reconsider the rationale for its previous answer, and got a very polite apology for being incorrect, together with a different Python program. ![]() It also misunderstood what the algorithm does and what its output means, and that’s a more serious error. So ChatGPT didn’t actually run the program not surprising, many commentators have noted that ChatGPT doesn’t run the code that it writes. After fixing the obvious errors, the Python code looked like a correct implementation of Miller-Rabin–but the number that Miller-Rabin outputs isn’t a factor, it’s a “witness” that attests to the fact the number you’re testing isn’t prime. First, 9999960800038127 isn’t divisible by 29 (I’ll let you prove this to yourself). The code as given had a couple of basic syntactic errors–but that wasn’t the only problem. ChatGPT gave me a bunch of Python code that implemented the Miller-Rabin primality test, and said that my number was divisible by 29. (There’s probably a big list of prime numbers somewhere in its training set.) However, its reasoning was incorrect–and that’s a lot more interesting. This is somewhat surprising because, if you’ve read much about ChatGPT, you know that math isn’t one of its strong points. Learn moreĬhatGPT correctly answered that this number was not prime. Get a free trial today and find answers on the fly, or master something new and useful. Join the O'Reilly online learning platform. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |