# include # include # include using namespace std; # include "collatz_recursive.hpp" //****************************************************************************80 void collatz_path ( int n ) //****************************************************************************80 // // Purpose: // // collatz_path() prints the members of a Collatz sequence. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 09 March 2012 // // Author: // // John Burkardt // // Parameters: // // Input, int N, the current path member. // { cout << " " << n << "\n"; if ( n == 1 ) { } else if ( n % 2 == 0 ) { collatz_path ( n / 2 ); } else { collatz_path ( 3 * n + 1 ); } return; }