All pastes #334483 Raw Edit

Anonymous

public c v1 · immutable
#334483 ·published 2007-01-31 17:21 UTC
rendered paste body
#include <stdio.h>int main(){    unsigned long n;    unsigned long count=0;    scanf("%ld", &n);    while(n != 1) {        if(n == 3) {            count += 2;            n = 1;        } else if(n%2 == 0) {            n /= 2;            count++;        } else if((n+1)%4 == 0) {            n = (n+1)/4;            count += 3;        } else if((n-1)%4 == 0) {            n = (n-1)/4;            count += 3;        }    }    printf("%ld", count+1);    return 0;}