# include # include # include "collatz_recursive.h" /******************************************************************************/ void collatz_path ( int n ) /******************************************************************************/ /* 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 Input: int N, the current path member. */ { printf ( " %d\n", n ); if ( n == 1 ) { } else if ( n % 2 == 0 ) { collatz_path ( n / 2 ); } else { collatz_path ( 3 * n + 1 ); } return; }