OFFSET
1,2
COMMENTS
This sequence generated by operations [+ * - /] which is slowest increasing among total 24 permutation operations sequences.
The total 24 sequences can be grouped as 6 patterns of as following:
1: [+ - * /], [- * / +], [* / + -], [/ + - *]
2: [+ - / *], [- / * +], [/ * + -], [* + - /]
3: [+ * - /], [* - / +], [- / + *], [/ + * -]
4: [+ * / -], [* / - +], [/ - + *], [- + * /]
5: [+ / - *], [/ - * +], [- * + /], [* + / -]
6: [+ / * -], [/ * - +], [* - + /], [- + / *]
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
FORMULA
G.f.: -(-x^56 +x^55 +x^54 +x^53 -x^52 -2*x^50 +2*x^49 +3*x^48 +3*x^47 -4*x^46 +x^43 -3*x^41 +2*x^40 +4*x^39 +3*x^38 +3*x^37 +5*x^36 +2*x^35 -3*x^34 +x^31 -2*x^29 +x^28 +5*x^27 +2*x^26 +3*x^25 +4*x^24 +2*x^23 -3*x^22 +x^19 -2*x^17 +x^16 +4*x^15 +2*x^14 +4*x^13 +5*x^12 +3*x^11 -4*x^10 +x^7 -x^6 -2*x^5 +x^4 +5*x^3 +3*x^2 +2*x +1)*x / (-x^57 +x^54 -x^51 +x^48 +x^9 -x^6 +x^3 -1). - Alois P. Heinz, Feb 16 2013
EXAMPLE
x(3) = x(2) + x(1) = 2 + 1 = 3, a(3) = 3,
x(4) = x(3) * x(2) = 3 * 2 = 6, a(4) = 6,
x(5) = x(4) - x(3) = 6 - 3 = 3, a(5) = 3,
x(6) = x(5) / x(4) = 3 / 6 = 0.5, a(6) = 1,
x(7) = x(6) + x(5) = 0.5 + 3 = 3.5, a(7) = 4,...
MAPLE
x:= proc(n) option remember; `if`(n<3, n,
[(x, y)->x/y, (x, y)->x+y, (x, y)->x*y, (x, y)->x-y]
[1+irem(n-2, 4)](x(n-1), x(n-2)))
end:
a:= n-> round(x(n)):
seq(a(n), n=1..100); # Alois P. Heinz, Feb 16 2013
MATHEMATICA
x[n_] := x[n] = If[n<3, n, {#1/#2, #1+#2, #1*#2, #1-#2}[[1+Mod[n-2, 4]]]&[ x[n-1], x[n-2]]];
a[n_] := With[{q = x[n]}, If[Denominator[q] == 2, q+Sign[q]/2, Round[q]]];
Array[a, 100] (* Jean-François Alcover, Mar 18 2021 *)
PROG
(Small Basic)
a[1]=1
a[2]=2
For n=3 To 100
nn = math.Remainder(n, 4)
If nn = 3 Then ' operation +
a[n]=a[n-1]+a[n-2]
Else
EndIf
If nn = 0 Then ' operation *
a[n]=a[n-1]*a[n-2]
Else
EndIf
If nn=1 Then ' operation -
a[n]=a[n-1]-a[n-2]
Else
EndIf
If nn=2 Then ' operation /
a[n]=a[n-1]/a[n-2]
Else
EndIf
EndFor
For j = 1 to 100
TextWindow.Write(j+" ")
TextWindow.Write(math.Round(a[j]))
TextWindow.WriteLine(" ")
EndFor
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Kival Ngaokrajang, Feb 10 2013
STATUS
approved