Cycle detection: Difference between revisions

Content added Content deleted
(→‎{{header|jq}}: move specifics to the end)
Line 1,304: Line 1,304:
|.lambda += 1 )
|.lambda += 1 )
| {lambda, mu} ;
| {lambda, mu} ;

def f: (.*. + 1) % 255;


def task(f; x0):
def task(f; x0):
Line 1,315: Line 1,313:
"Cycle:",
"Cycle:",
skip(.mu; limit((.lambda + .mu); 3 | recurse(f)));
skip(.mu; limit((.lambda + .mu); 3 | recurse(f)));
</lang>
'''The specific function and task'''
<lang jq>
def f: (.*. + 1) % 255;


task(f;3)
task(f;3)