<commit_before><commit_msg>Create collatz.c<commit_after>/**
 * collatz.c contains a recursive function 'collatz()' that
 * tracks the amount of steps it takes for an integer (in
 * this case the atoi of argv[1]) to reach 1.
 */

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int collatz(int n);

int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        printf("Usage: ./collatz (Number)");
        return 1;
    }
    
    int n = atoi(argv[1]);
    
    int steps = collatz(n);

    printf("Steps: %i\n", steps);

    return 0;
}

int collatz(int n)
{
    printf("n = %i\n", n);
    
    if (n == 1)
    {
        return 0;
    }
    else 
    {
        if ((n % 2) == 0)
        {
            return 1 + collatz(n / 2);
        }
        else
        {
            return 1 + collatz((3*n) + 1);
        }
    }
}
{'fraction_non_alphanumeric': 0.15595238095238095, 'fraction_numerical': 0.017857142857142856, 'mean_word_length': 1.739413680781759, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3657086', 'n_tokens_mistral': 323, 'n_tokens_neox': 307, 'n_words': 87}