Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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 :: django admin text box 
Python :: NumPy bitwise_xor Syntax 
Python :: python bot ban script 
Python :: Python Zigzag a matrix for dct 
Python :: Reducing noise on Data 
Python :: python sum only numbers 
Python :: get values from list of dictionaries python 
Python :: best time to buy and sell stock python 
Python :: NumPy resize Syntax 
Python :: validating credit card numbers 
Python :: python find all occurrence in string 
Python :: what is in the python built in namespace 
Python :: django convert model to csv 
Python :: how to input a full array in one input in python 
Python :: how to combine number of excel files into a single file using python or pandas 
Python :: with open python print file name 
Python :: ensemble model using voting classifier 
Python :: python remove first element of array 
Python :: python counting up and down 
Python :: python convert datetime to float 
Python :: node 14 alpine add python 
Python :: maximun row and columns in python 
Python :: fill_between matplotlib 
Python :: How to remove case sensitive django filter 
Python :: quick sort algorithm in python 
Python :: Python program to print all even numbers in a range 
Python :: run python test in terminal 
Python :: python check if string contains one of characters list 
Python :: python string is in list 
Python :: size of int in python 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =