r/maths • u/The_Banana_Monk • 5d ago
💡 Puzzle & Riddles is this sequence possible to write as a formula?
1,2,4,5,7,8,10,11,13,14....
basically all multiples of 3 are missing.
12
Upvotes
r/maths • u/The_Banana_Monk • 5d ago
1,2,4,5,7,8,10,11,13,14....
basically all multiples of 3 are missing.
9
u/uTRexAap 4d ago
f(x) = (6x-3-(-1)^x)/4 works
3
u/SupermarketUseful519 4d ago
I’d say the easiest way is to look at the differences between the numbers. It’s +1, then +2, then +1 again, and so on.
So you can start with 1 and just keep adding 1 and 2 alternately.
If you want an actual formula for the nth term, you could use:
a(n) = n + floor((n - 1)/2)
Or just take all positive integers and skip the multiples of 3. If you’re doing it in code, n % 3 != 0 does the job.
Depends on whether you want to describe the pattern, calculate a particular term, or generate the sequence.
2
u/berwynResident 4d ago
a(n) = 3 + a(n-2)
5
u/matt7259 4d ago
Yes, in several ways.
1
u/Another_Little_Star 4d ago
can i use trig?
so ceil(-|(cos((n)*pi/3))|)+1
every 3 digits you have 2 followed 1s and one 0, you can adjust each value by multiplying everything by n
so (-1)n and cos(npi) and sin(npi) are periodic, in cos(n) you can change the period to every three digits or anything, by adjusting with absolute value and ceiling you get what you desired
1
u/mH48124 4d ago
[ (3n-1)/2 ]
1
u/Kyng5199 2d ago
Well, we're going up by 3, every 2 terms of the sequence. So, let's consider a(n) = 3n/2:
1.5, 3, 4.5, 6, 7.5, 9, ...
To get the sequence we need, we have to subtract 0.5 from the odd terms, and 1 from the even terms.
Dealing with the 0.5 is easy. Consider b(n) = (3n - 1)/2:
1, 2.5, 4, 5.5, 7, 8.5, ...
Now, we just need to subtract an additional 0.5 from the even terms. (1 + (-1)^n) will be 2 when n is even, and 0 when n is odd. So, we can set c(n) = (3n - 1)/2 - (1 + (-1)^n)/4:
1, 2, 4, 5, 7, 8, ...
Or, as an optional last step, if you want to tidy up c(n) a bit:
c(n) = (3n - 1)/2 - (1 + (-1)^n)/4
c(n) = (6n - 2)/4 - (1 + (-1)^n)/4
c(n) = (6n - 2 - 1 - (-1)^n)/4
c(n) = (6n - 3 - (-1)^n)/4
Hope that helps!
1
u/smitra00 4d ago
Solution for lazy people with access to computer algebra systems:
Define
f(x) = 1 + 2 x + 4 x^2 + 5 x^3 + 7 x^4 + 8 x^5 + 10 x^6 + 11 x^7 + 13 x^8 + 14 x^9 + 16 x^10...
Computing the [5,5] Padé approximant using the terms up to x^10 yields:
https://en.wikipedia.org/wiki/Pad%C3%A9_approximant
f(x) = (1 + x + x^2)/(1 -x - x^2 + x^3)
The sum of the degrees of numerator and denominator is 5 which is less than 10, therefore we can be confident that this is the exact answer. Expanding in partial fractions yields:
f(x) = 1/4 1/(x+1) + 3/4 1/(x-1) + 3/2 1/(x-1)^2
We then see that the coefficient of x^n is:
1/4 (-1)^n - 3/4 + 3/2 (n+1) = 1/4 (-1)^n + 3/4 + 3/2 n
This then yields the numbers in the sequence with the first term having the index n = 0.