Jump to content

De Bruijn sequences: Difference between revisions

m
→‎{{header|REXX}}: simplified the program, changed some comments.
m (simplified the making the sequence invalid (part of the last task requirement).)
m (→‎{{header|REXX}}: simplified the program, changed some comments.)
Line 113:
say right($, 130) /*display 130 right-most digits of seq.*/
say /*display a blank line. */
call val $ /*call the CHECKVAL sub for verification. */
@deB= 'reversed' @deB /*next, we'll check on a reversed seq.*/
$$= reverse($) /*do what a mirror does, reversify it.*/
call val $$ /*call the CHECKVAL sub for verification. */
good$= substroverlay($., 4444$, 14444) /*obtain thereplace 4,444th digit inwith thea seqperiod. */
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.*/
call val $ /*call the CHECKVAL sub for verification. */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Cookies help us deliver our services. By using our services, you agree to our use of cookies.