De Bruijn sequences: Difference between revisions
Content added Content deleted
m (simplified the making the sequence invalid (part of the last task requirement).) |
m (→{{header|REXX}}: simplified the program, changed some comments.) |
||
Line 113: | Line 113: | ||
say right($, 130) /*display 130 right-most digits of seq.*/ |
say right($, 130) /*display 130 right-most digits of seq.*/ |
||
say /*display a blank line. */ |
say /*display a blank line. */ |
||
call val $ /*call the |
call val $ /*call the VAL sub for verification. */ |
||
@deB= 'reversed' @deB /*next, we'll check on a reversed seq.*/ |
@deB= 'reversed' @deB /*next, we'll check on a reversed seq.*/ |
||
$$= reverse($) /*do what a mirror does, reversify it.*/ |
$$= reverse($) /*do what a mirror does, reversify it.*/ |
||
call val $$ /*call the |
call val $$ /*call the VAL sub for verification. */ |
||
$= overlay(., $, 4444) /*replace 4,444th digit with a period. */ |
|||
bad= right(good+1, 1) /*add 1 to it, obtain rightmost digit.*/ |
|||
$= overlay(bad,$, 4444) /*put that digit into the 4,444th place*/ |
|||
@deB= 'overlaid' subword(@deB, 2) /* [↑] this'll cause a validation barf.*/ |
@deB= 'overlaid' subword(@deB, 2) /* [↑] this'll cause a validation barf.*/ |
||
call val $ /*call the |
call val $ /*call the VAL sub for verification. */ |
||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |