login
A075085
a(n) is the smallest number not already in the sequence such that Sum_{k=1..n} a(k) is divisible by prime(n).
1
2, 1, 7, 4, 8, 17, 12, 6, 35, 24, 39, 30, 20, 10, 67, 36, 95, 14, 42, 28, 87, 48, 32, 137, 72, 238, 22, 44, 131, 161, 55, 179, 78, 26, 130, 177, 84, 247, 60, 90, 269, 213, 170, 34, 68, 233, 5, 204, 295, 265, 76, 114, 38, 190, 371, 120, 389, 313, 132, 88, 327, 230, 15, 399
OFFSET
1,1
COMMENTS
Original title: Rearrangement of natural numbers such that the n-th partial sum is divisible by the n-th prime.
The numbers 3, 9, 13, ... do not appear in the first 1655 terms of this sequence. Is this truly a permutation of the natural numbers? - Derek Orr, Jun 16 2015
a(100959)=13. - Alois P. Heinz, Jun 17 2015
The numbers 3, 9, 16, 18, 19, ... do not appear in the first 80 million terms of this sequence - Carl R. White, Mar 07 2024
MAPLE
b:= proc() false end:
s:= proc(n) option remember; a(n)+s(n-1) end: s(0):=0:
a:= proc(n) option remember; local k, p; p:= ithprime(n);
for k from p*(iquo(s(n-1), p)+1)-s(n-1)
while b(k) by p do od; b(k):= true; k
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jun 17 2015
MATHEMATICA
f[lst_] := Block[{k = 1, p = Prime[1 + Length@ lst], s = Total@ lst}, While[Mod[s + k, p] != 0 || MemberQ[lst, k], k++]; Append[lst, k]]; Nest[f, {}, 64] (* Robert G. Wilson v, Jun 17 2015 *)
PROG
(PARI) v=[2]; n=1; while(n<10^3, s=(n+vecsum(v))%prime(#v+1); if(!(s||vecsearch(vecsort(v), n)), v=concat(v, n); n=0); n++); v \\ Derek Orr, Jun 16 2015
CROSSREFS
Sequence in context: A089225 A185110 A343202 * A217458 A124048 A087059
KEYWORD
nonn,look
AUTHOR
Amarnath Murthy, Sep 13 2002
EXTENSIONS
More terms from David Wasserman, Jan 16 2005
STATUS
approved