Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

151 - Power Crisis

def power_crisis(n,k):
    if n == 1:
        return 1
    else:
        return (power_crisis(n-1,k)+k-1)%n+1

while True:
    n = int(input())
    if n == 0:
        break
    i = 1
    while power_crisis(n-1,i) != 12:
        i += 1
    print(i)
Comment

PREVIOUS NEXT
Code Example
Python :: make django admin page text box smaller 
Python :: set lable of field django 
Python :: python identify image mode 
Python :: algebraic pyramid python 
Python :: how draw shell in python 
Python :: python string not contains 
Python :: parser.add_argument array python 
Python :: keras sequential layer without input shape 
Python :: import combination 
Python :: set difference in multidimensional array numpy 
Python :: compiling python code 
Python :: query first 5 element in django 
Python :: python overwrite multiline text 
Python :: keras backend matrix multiplication 
Python :: * in python 
Python :: plot multiple columns in different colors plotly 
Python :: sklearn tree visualization 
Python :: plotly create plot 
Python :: theme_use() tkinter theme usage 
Python :: how to make a static variable in python 
Python :: Python NumPy asfarray Function Example Tuple to float type array 
Python :: set pop in python 
Python :: python book 
Python :: how to get the end of a item in a python array 
Python :: pandas create dataframe from multiple dictionaries 
Python :: geopandas replace column name 
Python :: concatenate strings of numpy array python 
Python :: difference between 2 dataframes 
Python :: regex find all sentences python 
Python :: tail a log file with python 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =