OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1)=1 by definition.
a(2)=3 because then a(2)+a(1)=3+1=4 which is a multiple of 2. a(2) cannot be 1 (which would lead to a sum of 2) because this has already appeared.
Likewise, a(3)=6 so that a(3)+a(2)=6+3=9 which is a multiple of 3.
a(4)=2 so that a(4)+a(3)=2+6=8 and so on.
PROG
(PARI) v=[1]; n=1; while(n<100, s=n+v[#v]; if(!(s%(#v+1)||vecsearch(vecsort(v), n)), v=concat(v, n); n=0); n++); v \\ Derek Orr, Jun 16 2015
(MATLAB)
N = 100;
M = 10*N; % find a(1) to a(N) or until a(n) > M
B = zeros(1, M);
A = zeros(1, N);
mmin = 2;
A(1) = 1;
B(1) = 1;
for n = 2:N
for m = mmin:M
if mmin == m && B(m) == 1
mmin = mmin+1;
elseif B(m) == 0 && rem(m + A(n-1), n) == 0
A(n) = m;
B(m) = 1;
if m == mmin
mmin = mmin + 1;
end;
break
end;
end;
if A(n) == 0
break
end
end;
if A(n) == 0
A(1:n-1)
else
A
end; % Robert Israel, Jun 17 2015
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Mark Hudson (mrmarkhudson(AT)hotmail.com), Oct 20 2004
STATUS
approved