Well, if the programming language had some primes(); function that prints primes, then no, it shouldn’t. If this is a random choice of a program written by a human being, ditto.
If we are talking of some programming language like C, or assembly, or especially Turing machine, and randomly generated programs, then i’m pretty sure if you see 2,3,5,7,11 it is still quite unlikely (on order of 10^-4 at least) that program would print primes correctly. (However the chance that program prints 13 next would be way higher than 10^-4)
In general, the generated programs have a tendency to do really weird stuff. There was an example posted right here:
And the likehood btw depends on programming language. With wolfram alpha, ‘5 primes’ will print you the primes. With x-86 assembly, division instruction may be used. With z-80 assembly, there’s no division or multiplication instruction. With Turing machine or anything of this sort even the addition needs to be ‘reinvented’.
With a language that has huge library of functions, with huffman-coded names (approximately the human language), the complexity will greatly depend to how often people who made that library expected to use primes.
Well, if the programming language had some primes(); function that prints primes, then no, it shouldn’t. If this is a random choice of a program written by a human being, ditto.
If we are talking of some programming language like C, or assembly, or especially Turing machine, and randomly generated programs, then i’m pretty sure if you see 2,3,5,7,11 it is still quite unlikely (on order of 10^-4 at least) that program would print primes correctly. (However the chance that program prints 13 next would be way higher than 10^-4)
In general, the generated programs have a tendency to do really weird stuff. There was an example posted right here:
http://lesswrong.com/lw/9pl/automatic_programming_an_example/
And the likehood btw depends on programming language. With wolfram alpha, ‘5 primes’ will print you the primes. With x-86 assembly, division instruction may be used. With z-80 assembly, there’s no division or multiplication instruction. With Turing machine or anything of this sort even the addition needs to be ‘reinvented’.
With a language that has huge library of functions, with huffman-coded names (approximately the human language), the complexity will greatly depend to how often people who made that library expected to use primes.