Constant bf::test_helpers::FACTOR_SRC [−][src]
pub const FACTOR_SRC: &[u8]=
b"[\n Takes an integer from stdin and emits its factors to stdout\n\n Factor an arbitrarily large positive integer\n\n Copyright (C) 1999 by Brian Raiter\n under the GNU General Public License\n]\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-\n\n*\n* read in the number\n*\n\n<<<<<<<<<+\n[-[>>>>>>>>>>][-]<<<<<<<<<<[[->>>>>>>>>>+<<<<<<<<<<]<<<<<<<<<<]\n >>>>>>>>>>,----------]\n>>>>>>>>>>[------------------------------------->>>>>>>>>->]\n<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]-\n\n*\n* display the number and initialize the loop variable to two\n*\n\n[>++++++++++++++++++++++++++++++++++++++++++++++++.\n ------------------------------------------------<<<<<<<<<<<]\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.\n--------------------------.[-]\n>>>>>>>>>>>>++<<<<+\n\n*\n* the main loop\n*\n\n[ [-]>>\n\n *\n * make copies of the number and the loop variable\n *\n\n [>>>>[-]>[-]>[-]>[-]\n >[-]>[-]\n <<<<<<<[->>>+>+<<<<]>>>>>>>>]\n <<<<<<<<<<[>>>>>>[-<<<<+>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>>\n [>[->>>+>>+<<<<<]>>>>>>>>>]\n <<<<<<<<<<[>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<]>>>>>>>>>>\n\n *\n * divide the number by the loop variable\n *\n\n [>>>[-]>>>[-]>[-]>>>] initialize\n <<<<<<<<<<[<<<<<<<<<<]\n >>>>>>>>>[-]>>>>>>>+<<<<<<<<[+]+\n [ ->> double divisor until above dividend\n [>>>>>>[->++<]>>>>]<<<<<<<<<<\n [>>>>>>>>[-]>[-]\n <<<<[->>>++<<<]<<<<<<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<\n [->--------->>>>>>>>>+<<<<<<<<<<[->+<]]]]]]]]]]]>>]\n <<<<<<<<<<[>>>>>>>>>[-<+<<<+>>>>]<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>[-<+>\n [-<--------->>>>>>>>>>>+<<<<<<<<<<[-<+>]]]]]]]]]]]>>>]\n <<<<<<<<<<\n [>>>>[->>>+>>+<<<<<]<<<<<<<<<<<<<<]\n >>>>>>>>>>[>>>>>>>[-<<<+>>>]>>>]<<<<<<<<<<\n [>>>>>>>>[->-<]>\n [<<<<<<<<<[<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<]\n >>>>>>>>>>>>>>>>>>>]\n <<<<<<<<<<<<<<<<<<<]\n >>>>>>>>>[+[+[+[+[+[+[+[+[+[+[[-]<+>]]]]]]]]]]]<\n ]\n >>>>>>>>\n [ subtract divisor from dividend\n <<<<<<\n [>>>>>>>>[-]>[-]<<<<<[->>>+>+<<<<]>>>>>>]<<<<<<<<<<\n [>>>>>>>>[-<<<<+>>>>]<<<[->>>+>+<<<<]<<<<<<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>>>[-<<<<+>>>>]>]<<<<<<<<<<\n [>>>>>>>>[-<->]<<<<<<<<<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<\n [++++++++++[+>-<]>>>>>>>>>>-<<<<<<<<<<]]]]]]]]]]]>>>]\n >>>>>>>+\n [ if difference is nonnegative then\n [-]<<<<<<<<<<<<<<<<< replace dividend and increment quotient\n [>>>>[-]>>>>[-<<<<+>>>>]<<[->>+<<]<<<<<<<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>>[->+<<<+>>]>>]<<<<<<<<<<\n [>>>[->>>>>>+<<<<<<]<<<<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>>>[-<<<<<<+>>>>>>[-<<<<<<+>>>>>>\n [-<<<<<<+>>>>>>[-<<<<<<+>>>>>>\n [-<<<<<<+>>>>>>[-<<<<<<+>>>>>>\n [-<<<<<<+>>>>>>[-<<<<<<+>>>>>>\n [-<<<<<<+>>>>>>[-<<<<<<--------->>>>>>>>>>>>>>>>+<<<<<<<<<<\n [-<<<<<<+>>>>>>]]]]]]]]]]]>]\n >>>>>>>\n ] halve divisor and loop until zero\n <<<<<<<<<<<<<<<<<[<<<<<<<<<<]>>>>>>>>>>\n [>>>>>>>>[-]<<[->+<]<[->>>+<<<]>>>>>]<<<<<<<<<<\n [+>>>>>>>[-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>\n [-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>\n [-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>\n [-<<<<<<<+>>>>>>>[-<<<<<<<->>>>>>+>\n [-<<<<<<<+>>>>>>>]]]]]]]]]<<<<<<<\n [->>>>>>>+<<<<<<<]-<<<<<<<<<<]\n >>>>>>>\n [-<<<<<<<<<<<+>>>>>>>>>>>]\n >>>[>>>>>>>[-<<<<<<<<<<<+++++>>>>>>>>>>>]>>>]<<<<<<<<<<\n [+>>>>>>>>[-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>\n [-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>\n [-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>\n [-<<<<<<<<+>>>>>>>>[-<<<<<<<<->>>>>+>>>\n [-<<<<<<<<+>>>>>>>>]]]]]]]]]<<<<<<<<\n [->>>>>>>>+<<<<<<<<]-<<<<<<<<<<]\n >>>>>>>>[-<<<<<<<<<<<<<+>>>>>>>>>>>>>]>>\n [>>>>>>>>[-<<<<<<<<<<<<<+++++>>>>>>>>>>>>>]>>]<<<<<<<<<<\n [<<<<<<<<<<]>>>>>>>>>>\n >>>>>>\n ]\n <<<<<<\n\n *\n * make copies of the loop variable and the quotient\n *\n\n [>>>[->>>>+>+<<<<<]>>>>>>>]\n <<<<<<<<<<\n [>>>>>>>[-<<<<+>>>>]<<<<<[->>>>>+>>+<<<<<<<]<<<<<<<<<<<<]\n >>>>>>>>>>[>>>>>>>[-<<<<<+>>>>>]>>>]<<<<<<<<<<\n\n *\n * break out of the loop if the quotient is larger than the loop variable\n *\n\n [>>>>>>>>>[-<->]<\n [<<<<<<<<\n [<<[-]>>>>>>>>>>[-<<<<<<<<<<+>>>>>>>>>>]<<<<<<<<<<<<<<<<<<]\n >>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<]\n >>>>>>>>[>-<[+[+[+[+[+[+[+[+[+[[-]>+<]]]]]]]]]]]>+\n\n [ [-]\n\n *\n * partially increment the loop variable\n *\n\n <[-]+>>>>+>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<\n\n *\n * examine the remainder for nonzero digits\n *\n\n [<<<<<<[<<<<[<<<<<<<<<<]>>>>+<<<<<<<<<<]<<<<]\n >>>>>>>>>>>>>>>>>>>>[>>>>>>>>>>]<<<<<<<<<<[<<<<<<<<<<]\n >>>>-\n\n [ [+]\n\n *\n * decrement the loop variable and replace the number with the quotient\n *\n\n >>>>>>>>-<<[>[-]>>[-<<+>>]>>>>>>>]<<<<<<<<<<\n\n *\n * display the loop variable\n *\n\n [+>>[>>>>>>>>+>>]<<-<<<<<<<<<<]-\n [>>++++++++++++++++++++++++++++++++++++++++++++++++.\n ------------------------------------------------<<<<<<<<<<<<]\n ++++++++++++++++++++++++++++++++.[-]>>>>\n\n ]\n\n *\n * normalize the loop variable\n *\n\n >>>>>>\n [>>[->>>>>+<<<<<[->>>>>+<<<<<\n [->>>>>+<<<<<[->>>>>+<<<<<\n [->>>>>+<<<<<[->>>>>+<<<<<\n [->>>>>+<<<<<[->>>>>+<<<<<\n [->>>>>+<<<<<[->>>>>--------->>>>>+<<<<<<<<<<\n [->>>>>+<<<<<]]]]]]]]]]]>>>>>>>>]\n <<<<<<<<<<[>>>>>>>[-<<<<<+>>>>>]<<<<<<<<<<<<<<<<<]\n >>>>>>>>>\n\n ]<\n\n]>>\n\n*\n* display the number and end\n*\n\n[>>>>>>>>>>]<<<<<<<<<<[+>[>>>>>>>>>+>]<-<<<<<<<<<<]-\n[>++++++++++++++++++++++++++++++++++++++++++++++++.<<<<<<<<<<<]\n++++++++++.\n"
Source of the factoring program from ../bf/factor.bf
.