For any two strings of digits, $A$ and $B$, we define $F_{A,B}$ to be the sequence $(A,B,AB,BAB,ABBAB,\dots)$ in which each term is the concatenation of the previous two.
Further, we define $D_{A,B}(n)$ to be the $n^{\text{th}}$ digit in the first term of $F_{A,B}$ that contains at least $n$ digits.
Example:
Let $A = 1415926535$, $B = 8979323846$. We wish to find $D_{A,B}(35)$, say.
The first few terms of $F_{A,B}$ are: \(1415926535 \\ 8979323846 \\ 14159265358979323846 \\ 897932384614159265358979323846 \\ 1415926535897932384689793238461415\mathbf{\color{red}9}265358979323846\)
Then $D_{A,B}(35)$ is the $35^{\text{th}}$ digit in the fifth term, which is 9.
Now we use for $A$ the first 100 digits of $\pi$ behind the decimal point:
in Data Science on Image segmentation, Climate, Pytorch lightning, Kaggle
Using an image segmentation approach to tackle the Contrail Detection Kaggle competition by Google Research
This is part 1 in a short series of notebooks that will aim to tackle the Kaggle competition of predicting the presence of contrails in infrared image bands. The competition itself was hosted by Google Research and has since ended.
A program written in the programming language Fractran consists of a list of fractions.
The internal state of the Fractran Virtual Machine is a positive integer, which is initially set to a seed value. Each iteration of a Fractran program multiplies the state integer by the first fraction in the list which will leave it an integer.
For example, one of the Fractran programs that John Horton Conway wrote for prime-generation consists of the following 14 fractions: \(\frac{17}{91}, \frac{78}{85}, \frac{19}{51}, \frac{23}{38}, \frac{29}{33}, \frac{77}{29}, \frac{95}{23}, \frac{77}{19}, \frac{1}{17}, \frac{11}{13}, \frac{13}{11}, \frac{15}{2}, \frac{1}{7}, \frac{55}{1}\) Starting with the seed integer 2, success iterations of the program produce the sequence:
The powers of 2 that appear in this sequence are $2^2$, $2^3$, $2^5$, …
It can be shown that all the powers of 2 in this sequence have prime exponents and that all the primes appear as exponents of powers of 2, in proper order!
If someone uses the above Fractran program to solve Project Euler Problem 7 (find the $10001^{\text{st}}$ prime), how many iterations would be needed until the program produces $2^{10001\text{st prime}}$?
We define the Matrix Sum of a matrix as the maximum possible sum of matrix elements such that none of the selected elements share the same row or column.
For example, the Matrix Sum of the matrix below equals 3315 (= 863 + 383 + 343 + 959 + 767):
The four right-angled triangles with sides (9, 12, 15), (12, 16, 20), (5, 12, 13) and (12, 35, 37) all have one of the shorter sides (catheti) equal to 12. It can be shown that no other integer sided right-angled triangle exists with one of the catheti equal to 12.
Find the smallest integer that can be the length of a cathetus of exactly 47547 different integer sided right-angled triangles.
Albert chooses a positive integer $k$, then two real numbers $a$, $b$ are randomly chosen in the interval $[0, 1]$ with uniform distribution. The square root of the sum $(k\cdot a + 1)^2 + (k\cdot b + 1)^2$ is then computed and rounded to the nearest integer. If the result is equal to $k$, he scores $k$ points; otherwise he scores nothing.
For example, if $k=6$, $a=0.2$ and $b=0.85$, then $(k\cdot a + 1)^2 + (k\cdot b + 1)^2 = 42.05$. The square root of $42.05$ is $6.484\cdots$ and when rounded to the nearest integer, it becomes $6$. This is equal to $k$, so he scores $6$ points.
It can be shown that if he plays 10 turns with $k=1, k=2, \dots, k=10$, the expected value of his total score, rounded to five decimal places, is $10.20914$.
If he plays $10^5$ turns with $k=1,k=2,k=3,\dots,k=10^5$, what is the expected value of his total score, rounded to five decimal places?
in Wildfires on Geospatial data, Neural network, Climate
Part 3 of predicting wildfire incidence. I show a basic example of using a neural network on the same data for prediction.
We have seen how to properly preprocess the 3 data sources (historical wildfire incidence, climatology, and land usage) to get it ready to push it through a logistic regression model. However, the beauty of machine learning is that there is often more than one tool for the job.
in Wildfires on Logistic regression, Geospatial data, Climate
Part 2 of predicting wildfire incidence. After preprocessing, we perform spatial logistic regression using all the data on hand.
This is second in a series of posts detailing how to predict incidence of wildfires. For input data, we use historical wildfires, land usage data, and climatology data. In terms of preprocessing, we force all datasets to have the same 702 x 306 shape. The fire matrix contains a count of how many fires have occurred in that location. Please see Wildfire Incidence I - Preprocessing for a detailed code overview of the actual preprocessing.