

A099506


a(1)=1; for n > 1, a(n)=smallest m>0 that has not appeared so far in the sequence such that m+a(n1) is a multiple of n.


6



1, 3, 6, 2, 8, 4, 10, 14, 13, 7, 15, 9, 17, 11, 19, 29, 5, 31, 26, 34, 50, 16, 30, 18, 32, 20, 61, 23, 35, 25, 37, 27, 39, 63, 42, 66, 45, 69, 48, 72, 51, 33, 53, 79, 56, 36, 58, 38, 60, 40, 62, 94, 12, 96, 124, 44, 70, 46, 131, 49, 73, 113, 76, 52, 78, 54, 80, 192, 84, 126, 87
(list;
graph;
refs;
listen;
history;
text;
internal format)



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(n1), 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:n1)
else
A
end; % Robert Israel, Jun 17 2015


CROSSREFS

Cf. A099507 for positions of occurrences of integers in this sequence.
Sequence in context: A175458 A135598 A244619 * A205001 A154204 A266971
Adjacent sequences: A099503 A099504 A099505 * A099507 A099508 A099509


KEYWORD

easy,nonn


AUTHOR

Mark Hudson (mrmarkhudson(AT)hotmail.com), Oct 20 2004


STATUS

approved



