login
Meta recurrence: a(0) = 1, a(1) = 2, a(2) = 3, a(n) = a(n - a(n-3)) + 3 for n > 2.
2

%I #17 May 24 2024 03:29:17

%S 1,2,3,6,6,6,4,5,6,9,9,9,9,9,9,7,8,9,12,12,12,12,12,12,12,12,12,10,11,

%T 12,15,15,15,15,15,15,15,15,15,15,15,15,13,14,15,18,18,18,18,18,18,18,

%U 18,18,18,18,18,18,18,18,16,17,18,21,21,21,21,21,21,21

%N Meta recurrence: a(0) = 1, a(1) = 2, a(2) = 3, a(n) = a(n - a(n-3)) + 3 for n > 2.

%C The sequence is constructed by starting with 3*m copies of 3*(m+1), followed by 3*m+1, 3*m+2, 3*m+3, as m varies from 0, 1, 2, ... It is straightforward to check that this construction satisfies the recurrence relation.

%C The construction shows that the sequence is well defined, every positive integer is in the sequence, and every integer not a proper multiple of 3 appears only once. If t is a multiple of 3, then t appears t-2 times.

%C In general, the meta recurrence a(n) = a(n-a(n-k))+k with initial conditions a(i) = i+1 for i = 0,...,k-1 has a simple solution and can be constructed starting with k*m copies of k*(m+1), followed by k*m+1, k*m+2, ..., k*(m+1), as m varies from 0, 1, 2, ... This sequence is well defined, every positive integer is in the sequence, and every integer not a proper multiple of k appears once. If t is a multiple of k, then t appears t-k+1 times.

%H Chai Wah Wu, <a href="/A274213/b274213.txt">Table of n, a(n) for n = 0..10000</a>

%t A274213[n_] := A274213[n] = If[n < 3, n + 1, A274213[n - A274213[n - 3]] + 3]; Array[A274213, 100, 0] (* _Paolo Xausa_, May 24 2024 *)

%o (Python)

%o A274213_list = [1,2,3]

%o for n in range(3,10001):

%o A274213_list.append(A274213_list[-A274213_list[-3]]+3)

%o (Magma) I:=[1,2,3]; [n le 3 select I[n] else Self(n-Self(n-3))+3 : n in [1..80]]; // _Vincenzo Librandi_, Jun 18 2016

%Y Cf. A193358

%K nonn

%O 0,2

%A _Chai Wah Wu_, Jun 13 2016