diff --git a/Weird Algorithm.py b/Weird Algorithm.py new file mode 100644 index 0000000..2bc65bb --- /dev/null +++ b/Weird Algorithm.py @@ -0,0 +1,13 @@ +# Weird Algorithm problem link and solution from CSES +#https://cses.fi/problemset/task/1068/ + +n=int(input()) +l=[n] +while(n!=1): + if(n%2==0): + n=int(n/2) + l.append(n) + else: + n=n*3+1 + l.append(n) +print(*l)