Sha256: 0c193d8a3d821217153ce6c81f4c48453bc80d408de08884f4cf27b58b2b42fe
Contents?: true
Size: 306 Bytes
Versions: 95
Compression:
Stored size: 306 Bytes
Contents
#!/usr/bin/env bash if [ "$1" -gt 0 ]; then N=$1 else echo "Error: Only positive numbers are allowed" exit 1 fi STEP=0 while [ "$N" -ne "1" ] do if [ "$(($N % 2))" -eq "0" ]; then N=$(($N / 2)) else N=$((($N * 3) + 1)) fi STEP=$(($STEP + 1)) done echo $STEP
Version data entries
95 entries across 95 versions & 1 rubygems