login
a(0) = 2; for n > 0, a(n) = the smallest prime which is > a(n-1) such that a(n-1) + a(n) is a multiple of n.
4

%I #16 Mar 08 2020 00:04:27

%S 2,3,5,7,13,17,19,23,41,67,73,103,113,173,191,199,233,277,281,479,521,

%T 571,617,809,823,827,863,919,929,1217,1303,1487,1489,1613,1753,2027,

%U 2113,2179,2267,2647,2713,3109,3191,3259,3517,3593,3767,3847,3881,4057

%N a(0) = 2; for n > 0, a(n) = the smallest prime which is > a(n-1) such that a(n-1) + a(n) is a multiple of n.

%H Eric M. Schmidt, <a href="/A134207/b134207.txt">Table of n, a(n) for n = 0..1000</a>

%e The primes that are > a(8)=41 form the sequence 43,47,53,59,61,67,71,... Of these, 67 is the smallest that when added to a(8)=41 gets a multiple of 9 -- 41+67 = 108 = 9*12. (41+p is not divisible by 9 for p = any prime which is > 41 and is < 67.) So a(9) = 67.

%t a = {2}; For[n = 1, n < 100, n++, i = 1; While[Not[Mod[a[[ -1]] + Prime[PrimePi[a[[ -1]]] + i], n] == 0], i++ ]; AppendTo[a, Prime[PrimePi[a[[ -1]]] + i]]]; a (* _Stefan Steinerberger_, Oct 17 2007 *)

%o (Sage)

%o def A134207(max) :

%o res = [2]; p = 3

%o for n in range(1,max+1) :

%o while (res[n-1] + p) % n != 0 : p = next_prime(p)

%o res.append(p); p = next_prime(p)

%o return res # _Eric M. Schmidt_, May 23 2013

%Y Cf. A134204, A134208, A134209.

%K nonn

%O 0,1

%A _Leroy Quet_, Oct 14 2007

%E More terms from _Stefan Steinerberger_, Oct 17 2007