function [R] = A362909(nmax) % % Returns "R", the first occurences of values % within the first "nmax" terms of A362881. % % R: first column "n", second column "k" % first k such that A362881(k) = n % K=zeros(1,nmax); K(1:2)=[1 1]; R=[1 1]; for n=3:nmax r=1; for a=1:n-2 d=K(n-1-a)-K(n-1); f=2; while n-1-f*a>0 && K(n-1-f*a)-K(n-1-(f-1)*a)==d f=f+1; end if f>r r=f; end end K(n)=r; if ~any(R(:,1)==r) R=[R; r, n]; end end end