login
a(1) = a(2) = 1; a(n) = n - a(a(n-2)) - a(n-a(n-2)) for n > 2.
1

%I #18 Jun 26 2018 13:08:43

%S 1,1,1,2,2,3,4,5,5,6,6,6,6,6,7,7,7,8,9,9,10,11,11,12,13,14,15,16,16,

%T 17,17,18,19,19,19,20,20,21,21,21,22,22,22,22,23,23,24,24,24,24,24,24,

%U 25,25,25,26,26,26,26,27,28,28,28,28,29,29,30,31,31,32,33,33,33,33,34,35,36,37,37

%N a(1) = a(2) = 1; a(n) = n - a(a(n-2)) - a(n-a(n-2)) for n > 2.

%C Let a_i(n) = n - a_i(a_i(n-i)) - a_i(n-a_i(n-i)). This sequence is generated by a_2(n) with initial conditions 1, 1.

%H Altug Alkan, <a href="/A305557/a305557.pdf">Proof of basic property</a>

%F a(n+1) - a(n) = 0 or 1 for all n >= 1 and a(n) hits every positive integer.

%p a:=proc(n) option remember: if n<3 then 1 else n-procname(procname(n-2))-procname(n-procname(n-2)) fi; end: seq(a(n), n=1..100); # _Muniru A Asiru_, Jun 26 2018

%o (PARI) a=vector(99); a[1]=a[2]=1; for(n=3, #a, a[n] = n-a[a[n-2]]-a[n-a[n-2]]); a

%o (GAP) a:=[1,1];; for n in [3..100] do a[n]:=n-a[a[n-2]]-a[n-a[n-2]]; od; a; # _Muniru A Asiru_, Jun 26 2018

%Y Cf. A005229, A287422, A305845.

%K nonn,easy

%O 1,4

%A _Altug Alkan_, Jun 21 2018