The Ackermann function is indeed not "primitive recursive." However, it is computable, and therefore can be computed with loops. A while loop would work for example.
If you only have a for item in items type of loop where items cannot be changed inside the loop, that would not be good enough to compute the Ackermann function though.
It's easy to get confused with this stuff, but anything that you can implement with a computer program can be done without recursion. You can think of it this way: Hardware doesn't support recursion in the actual electronics (at least I don't think so), yet code in any programming language can be compiled down to machine language that's executed by the hardware.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The Ackermann function is indeed not "primitive recursive." However, it is computable, and therefore can be computed with loops. A
while
loop would work for example.If you only have a
for item in items
type of loop whereitems
cannot be changed inside the loop, that would not be good enough to compute the Ackermann function though.It's easy to get confused with this stuff, but anything that you can implement with a computer program can be done without recursion. You can think of it this way: Hardware doesn't support recursion in the actual electronics (at least I don't think so), yet code in any programming language can be compiled down to machine language that's executed by the hardware.