Finding a sequence of integers a(n) where a(1) = 1, a(2) = 2, a(3) = 2, a(4) = 5.
Polynomial interpolation can be used to find a polynomial which passes through a set of points. Using the points
(1, 1) (2, 2) (3, 2) (4, 5)
gives the polynomial
p(x) = 1 + (x-1) - 1/2*(x-1)*(x-2) + 2/3*(x-1)*(x-2)*(x-3)
which evaluates to
p(1) = 1
p(2) = 2
p(3) = 2
p(4) = 5
Then a(n) = [P(n)] (where [x] means the integer part of x) gives the sequence
1-2-2-5-15...
Given that the first 4 elements in the sequence are between 0 and 9, it could be possible to find the sequence in a non periodic irrational number’s decimal representation. If so, defining a(n) = (p-1+n)th decimal in x where x is the irrational number and p is the position at which the sequence occurs, solves the problem.
Choosing x = pi, a search finds the sequence at position p = 9416. Then
a(n) = (9415 + n)th decimal in pi
gives the sequence
1-2-2-5-7....
It’s easy to find a closed form for this a(n) by using a formula for the nth digit of pi.
The same technique could be used with other irrational numbers such as e.
The sequence 1-2-2-5 is very similar to the first Fibonacci numbers 0-1-1-2-3-5.... A slight modification in Fibonacci’s definition:
b(n) = b(n-1) + b(n-2) + (-1)^(n+1) with b(0) = 0 and b(1) = 1
results in
0-1-2-2-5-6...
Then a(n) = b(n+1) produces
1-2-2-5-6...
A closed form for this a(n) can be found by using Fibonacci’s closed form:
fib(n) = (phi^n - psi^n) / (phi - psi)
a(n) = fib(n+1) + (-1)^(n+1)
Where phi is a well known constant and psi = 1 - phi.
Another way of getting the sequence 1-2-2-5 from Fibonacci’s is to define
a(n) = fib(n+1) + g(n)
where
g(n) = 0 if n is odd
g(n) = n/2 if n is even
fib(n) = n-th fibonacci number = (phi^n - psi^n) / (phi - psi)
Then a(n) expands to
1-2-2-5-5-11-13...
Again, it’s possible to write a closed form expresion by noting that
g(n) = (n/2)*sin( (3/4)pi + ((-1)^(n+1)) * (pi/4) )
so
a(n) = fib(n+1) + (n/2)*sin(3/4)pi + ((-1)^(n+1))*(pi/4)))
A perfect square is an integer n such that n = p^2 for some integer p:
perfect squares = 0-1-4-9-16-25-36-49...
The sequence a(n) = perfect squares between 1 and n! + 2 follows the pattern
1-2-2-5-11...
To show it, here’s n! + 2 and a list of perfect squares
n! + 2 = 3-4-8-26-122...
perfect squares = 1-4-9-16-25-36-49-64-81-100-121...
Train a simple neural network (a 2-layer perceptron maybe) with the set
{(1, 1), (2, 2), (3, 2), (4, 5)}
Then, define a(n) = [r(n)] where r(n) is the output of the trained neural network. Since the output of neural networks are matrix multiplications, a closed form for the sequence a(n) will exist. If I get time to do this and it works I’ll update the post.
If p(n) = number of primes between 1 and n, then p(n) = 0-1-2-2-3-3-5. There is probably a function h such that p(h(n)) = a(n). Didn’t follow through with this idea since the perfect squares one is similar.
One way of turning 1-2-2-5 into a strictly growing funcion is to do something like a'(n) = 2^(n-1) - a(n) = 2-4-6-13... and then a(n) = 2^(n-1) - a'(n) gets defined (of course 2^(n-1) is just one posibility); then, finding a pattern for 2-4-6-13... is equivalent to finding one for 1-2-2-5.
The way a(n) grows can be obtained by subtracting two functions f and g that intersect each other in two points like this:
/\
|
| . . *
| . x x = intersection
| . * . * = g
| . * . . = f
| . *
| . *
| . *
| * x *
+---------------------->
Functions such as 2^n and n^2 + c. The idea is that the distances between such functions will grow and then decrease, just like the sequence does in the middle (2-2). For example, I tried this by subtracting two polynomials of degree two, so it leads to a system of equations and with a bit of luck the system could be solved and a solution found. I decided not to invest more effort since the system could have no solution and was too much mechanical work.
h(x) = x0 + x1*X + x2*X^2 - (y0 + y1*Y + y2*Y^2)
h(0) = x0 - y0 = 1 (start from 0 to get a cleaner equation and then correct the indices)
....
....
The function l(n) = The amount of bits needed to represent n almost works: 1-2-2-3. There’s probably a transformation that results in l(t(n)) = a(n) but I couldn’t find it.
Moving around the binary representations of the numbers of the sequence:
1 2 2 5
1 0 0 1
0 1 1 0
0 0 0 1
Some combinatorics problems look almost like the sequence, but they grow too fast after 2. In some of those problems the growth of the possible states is similar to the growth of a(n); there’s probably some classic combinatorics problem that can be parametrized in such a way that results in the sequence.
Search oeis service.