A105734 Duplicate of A076839.
1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1
Offset: 1
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
N:= 1000: # to get a(1) to a(N) S:= 'S': a[1]:= 1: a[2]:= 2: S[1]:= 1: S[2]:= 1: for n from 3 to N do ds:= map(t -> rhs(op(t)), [msolve(x^2=a[n-1]^2, 4*a[n-2])]); xmin:= infinity; for d in ds do found:= false; for y from floor((a[n-1]-d)/(4*a[n-2]))+1 do xy:= 4*a[n-2]*y + d; cand:= (xy^2 - a[n-1]^2)/(4*a[n-2]); if cand >= xmin then found:= false; break fi; if not assigned(S[cand]) then found:= true; break fi; od: if found then xmin:= cand; fi; od: a[n]:= xmin; S[xmin]:= 1; od: seq(a[n],n=1..N); # Robert Israel, May 11 2015
a = {1, 2}; Do[i = 1; While[MemberQ[a, i] || !IntegerQ[Sqrt[a[[-1]]^2 + 4 a[[-2]]*i]], i++]; AppendTo[a, i], {n, 3, 70}]; a (* Ivan Neretin, May 11 2015 *)
&cat[[0, 1, 2, 3, 4, 5, 4, 3, 2, 1]: n in [0..10]];
a:=n->[0, 1, 2, 3, 4, 5, 4, 3, 2, 1][(n mod 10)+1]: seq(a(n), n=0..100);
CoefficientList[Series[x*(1 + x + x^2 + x^3 + x^4)/(1 - x + x^5 - x^6), {x, 0, 30}], x]
a(n) = abs(n-10*round(n/10)); \\ Altug Alkan, Apr 13 2016
a := 1; b := 1; c := 1; f := proc(n) option remember; global a,b,c; if n=1 then RETURN(a); fi; if n=2 then RETURN(b); fi; if n=3 then RETURN(c); fi; RETURN((f(n-1)+f(n-2)+1)/f(n-3)); end;
nxt[{a_,b_,c_}]:={b,c,(b+c+1)/a}; Transpose[NestList[nxt,{1,1,1},110]][[1]] (* or *) PadRight[{},110,{1,1,1,3,5,9,5,3}] (* Harvey P. Dale, Jan 13 2015 *) LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 1},{1, 1, 1, 3, 5, 9, 5, 3},105] (* Ray Chandler, Aug 25 2015 *)
I:=[1,1,1,4,10,55]; [n le 6 select I[n] else 17*Self(n-2)-17*Self(n-4)+Self(n-6): n in [1..30]]; // Vincenzo Librandi, Aug 27 2016
LinearRecurrence[{0, 17, 0, -17, 0, 1}, {1, 1, 1, 4, 10, 55}, 40] (* Vincenzo Librandi, Aug 27 2016 *) nxt[{a_,b_,c_}]:={b,c,((c+1)(b+1))/a}; NestList[nxt,{1,1,1},30][[All,1]] (* Harvey P. Dale, Oct 01 2021 *)
Vec((1+x-16*x^2-13*x^3+10*x^4+4*x^5)/((1-x)*(1+x)*(1-16*x^2+x^4)) + O(x^30)) \\ Colin Barker, Aug 21 2016
RecurrenceTable[{a[n] == (a[n - 1] + 1) (a[n - 2] + 1) (a[n - 3] + 1)/a[n - 4], a[0] == a[1] == a[2] == a[3] == 1}, a, {n, 0, 12}] (* Michael De Vlieger, Aug 25 2016 *) a[ n_] := With[{m = Max[3 - n, n]}, If[ m < 4, 1, (a[m - 1] + 1) (a[m - 2] + 1) (a[m - 3] + 1)/a[m - 4]]]; (* Michael Somos, Jun 02 2019 *)
a(n) = if (n <=3, 1, (a(n-1)+1)*(a(n-2)+1)*(a(n-3)+1)/a(n-4)); \\ Michel Marcus, Aug 23 2016
def A(m, n) a = Array.new(m, 1) ary = [1] while ary.size < n + 1 i = a[1..-1].inject(1){|s, i| s * (i + 1)} break if i % a[0] > 0 a = *a[1..-1], i / a[0] ary << a[0] end ary end def A276175(n) A(4, n) end # Seiichi Manyama, Aug 23 2016
a := 1; b := 1; f := proc(n) option remember; global a,b; if n=1 then RETURN(a); fi; if n=2 then RETURN(b); fi; if n mod 2 = 1 then RETURN((f(n-1)+1)/f(n-2)); fi; RETURN((f(n-1)^2+1)/f(n-2)); end;
LinearRecurrence[{0, 0, 0, 0, 0, 1}, {1, 1, 2, 5, 3, 2}, 105] (* Jean-François Alcover, Nov 22 2017 *)
a := 1; b := 1; f := proc(n) option remember; global a,b; if n=1 then RETURN(a); fi; if n=2 then RETURN(b); fi; if n mod 2 = 1 then RETURN((f(n-1)+1)/f(n-2)); fi; RETURN((f(n-1)^3+1)/f(n-2)); end;
LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 1},{1, 1, 2, 9, 5, 14, 3, 2},99] (* Ray Chandler, Aug 25 2015 *)
Comments