login
a(n) = floor((n+2)/3) + ((n-1) mod 3).
8

%I #47 Oct 23 2022 23:11:25

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

%T 12,13,12,13,14,13,14,15,14,15,16,15,16,17,16,17,18,17,18,19,18,19,20,

%U 19,20,21,20,21,22,21,22,23,22,23,24,23,24,25,24,25,26,25,26

%N a(n) = floor((n+2)/3) + ((n-1) mod 3).

%C The sequence is formed by concatenating triples of the form (n, n+1, n+2) for n>=1. See A194961 and A194962 for the associated fractalization and interspersion. The sequence can be obtained from A008611 by deleting its first four terms.

%C The sequence contains every positive integer n exactly min(n,3) times. - _Wesley Ivan Hurt_, Dec 17 2013

%H Vincenzo Librandi, <a href="/A194960/b194960.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,1,-1).

%F From _R. J. Mathar_, Sep 07 2011: (Start)

%F a(n) = ((-1)^n*A130772(n) + n + 4)/3.

%F G.f.: x*(1 + x + x^2 - 2*x^3)/((1+x+x^2)*(1-x)^2). (End)

%F a(n) = A006446(n)/floor(sqrt(A006446(n))). - _Benoit Cloitre_, Jan 15 2012

%F a(n) = a(n-1) + a(n-3) - a(n-4). - _Vincenzo Librandi_, Dec 17 2013

%F a(n) = a(n-3) + 1, n >= 1, with input a(-2) = 0, a(-1) = 1 and a(0) = 2. Proof trivial. a(n) = A008611(n+3), n >= -2. See the first comment above. - _Wolfdieter Lang_, May 06 2017

%F From _Guenther Schrack_, Nov 09 2020: (Start)

%F a(n) = n - 2*floor((n-1)/3).

%F a(n) = (n + 2 + 2*((n-1) mod 3))/3.

%F a(n) = (3*n + 12 + 2*(w^(2*n)*(1 - w) + w^n*(2 + w)))/9, where w = (-1 + sqrt(-3))/2.

%F a(n) = (n + 4 + 2*A049347(n))/3.

%F a(n) = (2*n + 3 - A330396(n-1))/3. (End)

%F a(n) = (n + 4 - 2*A010892(2*n+4))/3. - _G. C. Greubel_, Oct 23 2022

%p A194960:=n->floor((n+2)/3)+((n-1) mod 3); seq(A194960(n), n=1..100); # _Wesley Ivan Hurt_, Dec 17 2013

%t (* First program *)

%t p[n_]:= Floor[(n+2)/3] + Mod[n-1, 3]

%t Table[p[n], {n, 1, 90}] (* A194960 *)

%t g[1] = {1}; g[n_]:= Insert[g[n-1], n, p[n]]

%t f[1] = g[1]; f[n_]:= Join[f[n-1], g[n]]

%t f[20] (* A194961 *)

%t row[n_]:= Position[f[30], n];

%t u = TableForm[Table[row[n], {n, 1, 5}]]

%t v[n_, k_]:= Part[row[n], k];

%t w = Flatten[Table[v[k, n-k+1], {n, 1, 13}, {k, 1, n}]] (* A194962 *)

%t q[n_]:= Position[w, n];

%t Flatten[Table[q[n], {n, 1, 80}]] (* A194963 *)

%t (* Other programs *)

%t CoefficientList[Series[(1 +x +x^2 -2 x^3)/((1+x+x^2) (1-x)^2), {x, 0, 100}], x] (* _Vincenzo Librandi_, Dec 17 2013 *)

%t Table[(n+4 -2*ChebyshevU[2*n+4, 1/2])/3, {n,80}] (* _G. C. Greubel_, Oct 23 2022 *)

%o (Magma) I:=[1,2,3,2]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..100]]; // _Vincenzo Librandi_, Dec 17 2013

%o (PARI) a(n)=(n+2)\3 + (n-1)%3 \\ _Charles R Greathouse IV_, Sep 02 2015

%o (SageMath) [(n+4 - 2*chebyshev_U(2*n+4, 1/2))/3 for n in (1..80)] # _G. C. Greubel_, Oct 23 2022

%Y Cf. A006446, A008611, A010892, A047878, A049347, A130772, A194961, A194962, A194963, A330396.

%K nonn,easy

%O 1,2

%A _Clark Kimberling_, Sep 06 2011