Skip to main content

Posts

Showing posts with the label problem53

Problem 53 Project Euler Solution with python

Combinatoric selections There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5 C 3 = 10. In general, n C r = n ! r !( n−r )! ,where r ≤ n , n ! = n ×( n −1)×...×3×2×1, and 0! = 1. It is not until n = 23, that a value exceeds one-million: 23 C 10 = 1144066. How many, not necessarily distinct, values of   n C r , for 1 ≤ n ≤ 100, are greater than one-million? This problem is also simple. There are few important points one has to consider before we can write a few for loops to solve the problem. You can call these points as algorithm also😊. 1) As you all know that two for loops required, one for n and one for r in n C r . According to the question the value of n(i.e first for loop) will start from 23 and end at 100. Value of r is discussed in (2). 2) The value of r in n C r will be in range of 4, n-4 i.e we can neglect the value of 0, 1, 2, 3, n-3,...