If ChatGPT should be able to generate any code, a function that outputs a set of prime numbers longs in Kotlin should be simple enough (unless you consider Kotlin, the 12th-20th most popular language according to various surveys, too obscure). One that has a good big-O runtime that is compact as possible. After a bit of futzing I get this:
fun sieve(n: Long) = (2L until n).fold((2L until n).toMutableList()){p,i->p.apply{for(j in i * 2 until n step i)this[(j-2).toInt()]=0}}.filter{it!= 0L}
and it works OK in some situations:
>>> sieve(100L)
res5: kotlin.collections.List<kotlin.Long> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
Let's try another test input -
>>> sieve(10000000L)
java.lang.OutOfMemoryError: Java heap space
Oops.
Also if the 12th-20th most popular language (Kotlin) being too obscure is the reason, how will they fare currently except with the most popular languages?
This is about as simple as a function as you can get. 95% of my programming work is standups, sprint planning and grooming, looking at Swagger or other API backend documentation for information, looking through Outlook, Teams and Confluence for information about my story, looking for UI on Figma, contacting various teams for more information - then someone wants me to review their pull request and stop to do that - but notice they have some business logic wrong because they don't fully understand the domain. Yet even something simple like a function generating a list of prime numbers, ChatGPT struggles with.
Not that it can't get better, but it's no threat to most programmers I know in the short term (and if it becomes one, I'll shift over to writing Python scripts that call Pytorch, numpy etc. - I already do so in my spare time).