This repositry contains worked out jupyter notebook files for some kaggle competitions and other Machine learning/ Deep learning projects
Relevant problem statement and datasets can be found here on kaggle website
Relevant problem statement and datasets can be found here on kaggle website
Relevant problem statement and datasets can be found here on kaggle website
Using nltk library, we can create fill in the blanks type questions by randomly selecting proper noun or noun as the blank
- Ever wondered what happens to different chess pieces if there is infinite/finite board and it is numbered it in someway, and you want to move your chess piece that it keeps moving to unseen squares and are numbered smallest possible, here I tried to implement this problem with knight and the pattern of numbers on chess board are increasing outwards spirally.
- Got the inspiration to write this from this numberphile video, and it's beautiful
- Find the images of the patterns the knight follow here
here is how the names and titles are given to images length : number after 'length_' is number of squares in a row or column of the chessboard
pattern : two numbers seperated by space after 'pattern_' is the pattern which the knight is following while moving
infi/small board : 'infi board' conveys that the knight is trapped because all possible moves have been visited where as 'small board' conveys that the knight is trapped because the board is small/constrained and could have moved even more if the board was big
struck at : the number of the square where the knight is struck on the chessboard
after : number of moves the knight made before getting trapped.- Best thing, I felt so content when I saw the colorful patterns of knight for different patterns and different board sizes, a crucifix, a window, a windmill....I am attaching some images here for your pleasure.
- found this link which tells you where the conventional knight gets trapped for different sizes of chess board, in case you want to check if your code is running
multiplicative persistence of a number is basically a measure of how long it can persist from being transformed into a single digit. Steps to find multiplicative persistence are as follows: 1- if the input number is a single digit, it's persistence is 0, as it is already a single digit. 2- if input number is of length more than 1. break it into single digits and multiply those digits with each other, if resultant number is a single digit, number of steps from input number to final single digit is multiplicative persistence 3- if the resultant number is not a single digit, perform step two again
I Got the inspiration to write this from this numberphile video, Matt Parker explained it really well. I encourage you to look at it once, if you have not yet.
if we mechanincally code down to find out persistence for each number it will take a lot of time, as for big numbers you have to bring it back down to single integer by iterating the process.
Instead, we can use dictionary to keep track of already processed numbers and use processed numbers' persistence to calcualte present number's persistence
ex: persistence(27) = persistence(14)+1 = 2
though it seems like not so important, we can basically see huge amount of time saved when the numbers get bigger and bigger
so what are the keys of numbers to be stored in dictionary? as persistence of numbers with permutative digits are always same, we should keep the key to be something which should be same for permutative numbers. i.e, say number 23456 and number 45236 should have same key, so counting number of occurence of each digit and convertin it to a tuple should work in awesome way. ahem, ahem. those who are wondering why not arrays, remember arrays are not hashable. And this way we will effectively calculate persistence for only number instead of all of it's permutative equivalents.
so for example, number 234562 will be converted into (0,0,2,1,1,1,1,0,0,0) I have attached the images I got from the analysis of numbers till 10 crores. For first image only one number is considered from all equivalent permutative numbers. i.e, out of these numbers 123,231,321,312,132,213 only 123 is considered as all of them have same multiplicative persistence. The graph is plotted for different persistences and total number of numbers with each persistence. for second image every number till 10 crores are considered (i.e, permutatively equivalent numbers are considered different each one is counted one time). If you want accurate numbers in both cases, check csv files attached here
These are the smallest numbers with respective persistence