The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306399 a(1)=1; a(n) = number of occurrences of a(n-1) if a(n-1) is odd; a(n) = number of occurrences of a(n-2) if a(n-1) is even. 1
1, 1, 2, 2, 2, 3, 1, 3, 2, 2, 5, 1, 4, 4, 2, 2, 7, 1, 5, 2, 2, 9, 1, 6, 6, 2, 2, 11, 1, 7, 2, 2, 13, 1, 8, 8, 2, 2, 15, 1, 9, 2, 2, 17, 1, 10, 10, 2, 2, 19, 1, 11, 2, 2, 21, 1, 12, 12, 2, 2, 23, 1, 13, 2, 2, 25, 1, 14, 14, 2, 2, 27, 1, 15, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,-1).
FORMULA
From Colin Barker, Aug 24 2019: (Start)
G.f.: x*(1 + x + 2*x^2 + 2*x^3 + 2*x^4 + 3*x^5 + x^6 + 3*x^7 + 2*x^8 + 2*x^9 + 5*x^10 - x^11 + 2*x^12 - 2*x^14 - 2*x^15 + x^16 - x^17 - x^18 - 2*x^19 - 2*x^20 - x^21 - x^23) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10)^2).
a(n) = 2*a(n-11) - a(n-22) for n>24.
(End)
EXAMPLE
Since a(6) is odd, a(7) = number of occurrences of a(6). Number of occurrences of a(6)=3 up to that point is 1.
a(14) is even, so a(15) = number of occurrences of a(13). Number of occurrences of a(13)=4 up to that point is 2.
MATHEMATICA
CoefficientList[Series[(1 + x + 2*x^2 + 2*x^3 + 2*x^4 + 3*x^5 + x^6 + 3*x^7 + 2*x^8 + 2*x^9 + 5*x^10 - x^11 + 2*x^12 - 2*x^14 - 2*x^15 + x^16 - x^17 - x^18 - 2*x^19 - 2*x^20 - x^21 - x^23)/((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10)^2), {x, 0, 100}], x] (* Wesley Ivan Hurt, Aug 24 2019 *)
PROG
(VBA/Excel)
Sub 306399()
Cells(1, 1)=1
For n = 2 To 200
k = 2 - (Cells(n - 1, 1) Mod 2)
m = Cells(n - k, 1)
S = 0
For j = 1 To n - 1
If Cells(j, 1) = m Then
S = S + 1
End If
Next j
Cells(n, 1) = S
Next n
End Sub
(Python)
n, aa = 1, [1]
print(n, 1)
while n <= 75:
sa = aa[len(aa)-2+aa[len(aa)-1]%2]
i, a = 0, 0
while i < len(aa):
if sa == aa[i]:
a = a+1
i = i+1
print(n, a)
n, aa = n+1, aa+[a] # A.H.M. Smeets, Aug 23 2019
(PARI) nbo(v, i) = #select(x->(x == v[i]), v);
lista(nn) = {v = vector(nn); v[1] = 1; for (k=2, nn, if (v[k-1] % 2, v[k] = nbo(v, k-1), v[k] = nbo(v, k-2)); ); v; } \\ Michel Marcus, Aug 24 2019
(PARI) Vec(x*(1 + x + 2*x^2 + 2*x^3 + 2*x^4 + 3*x^5 + x^6 + 3*x^7 + 2*x^8 + 2*x^9 + 5*x^10 - x^11 + 2*x^12 - 2*x^14 - 2*x^15 + x^16 - x^17 - x^18 - 2*x^19 - 2*x^20 - x^21 - x^23) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10)^2) + O(x^80)) \\ Colin Barker, Aug 25 2019
(PARI) A306399_upto(N, c=Map([0; 1]~), L, P)=vector(N, i, [P, L]=[L, mapget(c, if(bitand(L, 1), L, P))]; mapput(~c, L, iferr(mapget(c, L)+1, E, 1)); L) \\ M. F. Hasler, Sep 02 2019
CROSSREFS
Sequence in context: A103960 A242626 A360387 * A240689 A233567 A141059
KEYWORD
nonn,easy
AUTHOR
Ali Sada, Aug 22 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 13 17:28 EDT 2024. Contains 372522 sequences. (Running on oeis4.)