OFFSET
0,2
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 0..10000
A. S. Fraenkel, New games related to old and new sequences, INTEGERS, Electronic J. of Combinatorial Number Theory, Vol. 4, Paper G6, 2004.
FORMULA
See A099354.
MAPLE
a:=proc(n) option remember: local j, t: if(n=0)then return 0: else t:=a(n-1)+1: for j from 0 to n-1 do if(t=b(j))then return t+1: elif(t<b(j))then break: fi: od: return t: fi: end:
b:=proc(n) option remember: if(n=0)then return 0: else return b(n-1) - a(n-1) + a(n) + (-1)^b(n-1) - (-1)^a(n-1) + 3: fi: end:
seq(b(n), n=0..70); # Nathaniel Johnston, Apr 28 2011
MATHEMATICA
a[n_] := a[n] = Module[{j, t}, If[n == 0, 0, t = a[n - 1] + 1; For[j = 0, j <= n - 1, j++, Which[t == b[j], Return[t + 1], t < b[j], Break[]]]; t]];
b[n_] := b[n] = If[n == 0, 0, b[n - 1] - a[n - 1] + a[n] + (-1)^b[n - 1] - (-1)^a[n - 1] + 3];
Table[b[n], {n, 0, 70}] (* Jean-François Alcover, Mar 10 2023, after Nathaniel Johnston *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 16 2004
STATUS
approved