I'm out of mind! How can I write it program?
Hi I'm trying to solve this problem but I can't find out the algorithm. Imagine a list: [1,2,3,4,5] (The list must be Arithmetic progression! It can be any Arithmetic progression With any denominator with limited elements for example 100 elements) Output: We should start from multiple of 1 and 2 and 3 and so on ... and the last one is multiple of len(list) Multiple of 1: 1,2,3,4,... Multiple of 2: 2,4,6,8,.. Multiple of 3: 3,6,9,... And so on.. Now for multiple of 1 in our given list: [1,2,3,4,5] Multiple of 2 in our given list: [2,4] Multiple of 3 in our given list:[3] ... Multiple of 5 (the last one) in list: [5] Now first of all we change all elements to 0: [0,0,0,0,0] Now we start from the multiple of 1 and all the elements will be one: [1,1,1,1,1] Second we we start from multiple of 2 in our new [1,1,1,1,1] list and elements will be zero: [1,0,1,0,1] And now multiple of 3 in our new list: [1,0,0,0,1] And now for 4: [1,0,0,1,1] And for last one (5): [1,0,0,1,0] So [1,0,0,1,0] is output