max v2; #N vpatcher 171 67 1073 820; #P origin 0 742; #P window setfont "Sans Serif" 9.; #P window linecount 1; #N vpatcher 10 59 610 459; #P outlet 225 244 15 0; #P window setfont "Sans Serif" 9.; #P number 129 82 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P inlet 103 35 15 0; #P newex 198 157 93 196617 expr ($i1 * 3) + 1; #P number 225 210 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 102 157 65 196617 expr $i1 / 2; #P newex 102 122 192 196617 if ($i1 % 2) == 0 then $i1 else out2 $i1; #P fasten 5 0 0 0 134 111 107 111; #P connect 0 0 1 0; #P fasten 4 0 5 0 108 75 134 75; #P fasten 0 1 3 0 289 148 203 148; #P fasten 3 0 2 0 203 196 230 196; #P fasten 1 0 2 0 107 195 230 195; #P connect 2 0 6 0; #P pop; #P newobj 198 54 61 196617 p wondrous; #N vpatcher 10 59 610 459; #P outlet 369 278 15 0; #P button 369 241 15 0; #P window setfont "Sans Serif" 9.; #P newex 223 207 156 196617 if $i1 > 1 then \$1 else out2 bang; #P outlet 223 278 15 0; #P number 129 82 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P inlet 103 35 15 0; #P newex 198 157 93 196617 expr ($i1 * 3) + 1; #P number 223 243 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 102 157 65 196617 expr $i1 / 2; #P newex 102 122 192 196617 if ($i1 % 2) == 0 then $i1 else out2 $i1; #P fasten 5 0 0 0 134 111 107 111; #P connect 0 0 1 0; #P fasten 4 0 5 0 108 75 134 75; #P fasten 0 1 3 0 289 148 203 148; #P fasten 3 0 7 0 203 185 228 185; #P fasten 1 0 7 0 107 191 228 191; #P connect 7 0 2 0; #P connect 2 0 6 0; #P connect 7 1 8 0; #P connect 8 0 9 0; #P pop; #P newobj 462 462 67 196617 p wondrous2; #P number 488 570 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 471 588 27 196617 + 0; #P number 576 441 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 462 436 40 196617 % 128; #P number 535 494 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 578 571 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 537 601 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P button 596 600 18 0; #P newex 596 622 36 196617 flush; #B color 5; #P newex 496 625 92 196617 makenote 80 1000; #P newex 496 668 46 196617 noteout; #P user gswitch 414 620 41 32 1 0; #P newex 462 494 58 196617 pipe 0 100; #P button 519 518 15 0; #P button 337 258 15 0; #P button 430 340 15 0; #P newex 462 372 70 196617 random 1000; #P number 462 517 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 462 412 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P window setfont "American Typewriter" 14.; #P window linecount 2; #P comment 262 135 91 199491598 Being wondrous...; #P outlet 208 340 15 0; #P window setfont "Sans Serif" 9.; #P number 112 178 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P inlet 86 131 15 0; #P window linecount 1; #P newex 181 253 93 196617 expr ($i1 * 3) + 1; #P number 208 306 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 85 253 65 196617 expr $i1 / 2; #P newex 85 218 192 196617 if ($i1 % 2) == 0 then $i1 else out2 $i1; #P number 198 85 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 198 21 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P comment 484 554 41 196617 offset; #P comment 576 495 100 196617 delay the process; #P comment 450 340 100 196617 start the process; #P window linecount 2; #P comment 559 519 122 196617 <<< this will bang when the process is finished; #P comment 307 622 100 196617 turn the process on and off; #P window linecount 19; #P comment 460 37 407 196617 NB wondrous isn't an object \, but a sub-patch: double click on the subpatch and it will open in a new window and you can see the details. It's a relatively simple example of performing arithmetical operations on numbers in Max. The algorithm is that you take a number. If it's even then you divide it by two \, if it's odd you multiply it by three and add one. Then you take that result and feed it back into the loop. What you end up with is a list of numbers \, for instance: 6 3 10 5 16 8 4 2 1... In this case \, the number 6 - the number you started off with - is NOT wondrous \, as you end up with 1. Once the algorithm gets to 1 \, it generates a new (random) number and the sequence begins again. In number theory \, a number is wondrous only if it's sequence does not end with 1! In computing terms it's interesting because there's no way of proving whether a number is wondrous or not (as far as anyone knows) without going through the above test \, so if someone happened to come across a wondrous number they'd never know about it because the test would never end \, so they would never know whether it would end!; #P fasten 13 0 8 0 117 207 90 207; #P connect 8 0 9 0; #P fasten 12 0 13 0 91 171 117 171; #P fasten 8 1 11 0 272 244 186 244; #P connect 6 0 36 0; #P connect 36 0 7 0; #P fasten 9 0 10 0 90 291 213 291; #P fasten 11 0 10 0 186 292 213 292; #P connect 10 0 14 0; #P connect 8 1 20 0; #P fasten 17 0 23 1 467 579 434 579; #P fasten 21 0 18 0 524 543 554 543 554 364 467 364; #P fasten 19 0 18 0 435 364 467 364; #P fasten 23 0 16 0 419 606 400 606 400 410 467 410; #P connect 18 0 16 0; #P fasten 16 0 31 0 467 430 467 430; #P connect 31 0 35 0; #P connect 35 0 22 0; #P connect 22 0 17 0; #P fasten 17 0 33 0 467 539 476 539; #P connect 34 0 33 1; #P fasten 33 0 25 0 476 609 501 609; #P connect 25 0 24 0; #P fasten 26 0 24 0 601 652 501 652; #P fasten 30 0 22 1 540 513 529 513 529 486 515 486; #P connect 25 1 24 1; #P fasten 26 1 24 1 627 656 519 656; #P connect 35 1 21 0; #P connect 28 0 25 1; #P connect 31 0 32 0; #P connect 29 0 25 2; #P connect 27 0 26 0; #P pop;