%I #108 Sep 08 2022 08:45:05
%S 1,1,1,3,3,7,9,17,25,43,67,111,177,289,465,755,1219,1975,3193,5169,
%T 8361,13531,21891,35423,57313,92737,150049,242787,392835,635623,
%U 1028457,1664081,2692537,4356619,7049155,11405775,18454929,29860705,48315633,78176339
%N a(n+2) = a(n+1) + a(n) + (-1)^n, with a(1) = a(2) = 1.
%C Length of strings given by a successive substitution of a "modified" Kolakoski-(3, 1) sequence. Starting with 1, using the rule "string begins with 1 if previous string ends with 3, string begins with 3 if previous string ends with 1" then applying the classical Kolakoski-(3,1) rule. This gives: 1 -> 3 -> 111 -> 313 -> 1113111 -> 313111313 -> 11131113131113111 and the length of string are 1, 1, 3, 3, 7, 9, 17, ... At step n, length = a(n+1). This substitution leads to two sequences: 1, 1, 1, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, ... and 3, 1, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, 3, ... - _Benoit Cloitre_, Jun 01 2004
%C Lengths of comparators in subsequent layers of correction network F_n. - Grzegorz Stachowiak (gst(AT)ii.uni.wroc.pl), Nov 28 2004
%C Convolution of F(n+1) and A105812(n). Action of inverse of sequence array for F(n-1)*(-1)^n on F(n+1). - _Paul Barry_, Oct 29 2006
%D Omur Deveci, The Pell-Padovan sequences and the Jacobsthal-Padovan sequences in finite groups, Utilitas Mathematica, 98 (2015), 257-270.
%H Harry J. Smith, <a href="/A066983/b066983.txt">Table of n, a(n) for n = 1..250</a>
%H K. Atanassov, D. Dimitrov and A. G. Shannon, <a href="http://nntdm.net/volume-10-2004/number-1/01-11/">A remark on psi-function and Pell-Padovan's sequence</a>, Notes Number Theory Discrete Math., 15 (2009), no. 2, 1-44.
%H Michael Baake and Bernd Sing, <a href="http://arXiv.org/abs/math.MG/0206098">Kolakoski-(3,1) is a (deformed) model set</a>, arXiv:math/0206098 [math.MG], 2002-2003.
%H Taras Goy, S. V. Sharyn, <a href="https://doi.org/10.15330/cmp.12.2.280-288">A note on Pell-Padovan numbers and their connection with Fibonacci numbers</a>, Carpathian Math. Publ. (2020) Vol. 12, No. 2, 280-288.
%H Zehra İşbilir and Nurten Gürses, <a href="https://doi.org/10.7546/nntdm.2021.27.1.171-187">Pell-Padovan generalized quaternions</a>, Notes on Num. Theory and Disc. Math. (2021) Vol. 27, No. 1, 171—187.
%H G. Stachowiak, <a href="http://www.ii.uni.wroc.pl/~gst/papers/fcor.ps.gz">Fibonacci Correction Networks</a>, SWAT 2000, LNCS 1851, 535-548.
%H G. Stachowiak, <a href="http://www.ii.uni.wroc.pl/~gst/papers/lcor.ps.gz">Lower Bounds on Correction Networks</a>, ISAAC 2003, LNCS 2906, 221-229.
%H Dursun Tasci, <a href="https://dergipark.org.tr/en/pub/cfsuasmas/issue/41018/495797">Gaussian Padovan and Gaussian Pell-Padovan sequences</a>, Commun. Fac. Sci. Univ. Ank. Ser. A1 Math. Stat., 67 (2018), no. 2, 82-88. Sequence R_n.
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,1).
%F For n > 4 a(n-2) = floor(2 * phi^n/sqrt(5)) + (1 + (-1)^n)/2
%F a(n) = 2 * Fibonacci(n-2) + (-1)^n. - _Vladeta Jovovic_, Mar 19 2003
%F G.f.: x*(1+x-x^2)/((1+x)*(1-x-x^2)). - _Paul Barry_, Oct 29 2006
%F a(n) = A066629(n-2) - A066629(n-3), n > 2. - _R. J. Mathar_, Jan 14 2009
%F a(n) = floor(phi^(n-1)) - floor(phi^(n-1)/sqrt(5)). - _Federico Provvedi_, Mar 26 2013
%F a(1) = a(2) = a(3) = 1; for n > 3, a(n) = 2*a(n-2) + a(n-3). - _Taras Goy_, Aug 03 2018
%F a(n) = (-1)^n + (-1 - 3/sqrt(5))*((1/2)*(1 - sqrt(5)))^n + (-1 + 3/sqrt(5))*((1/2)*(1 + sqrt(5)))^n. - _Stefano Spezia_, Jul 22 2019
%p seq(coeff(series(x*(1+x-x^2)/((1+x)*(1-x-x^2)), x,n+1),x,n),n=1..40); # _Muniru A Asiru_, Aug 09 2018
%t Table[ Floor[ GoldenRatio^(k-1) ] - Floor[ GoldenRatio^(k-1) / Sqrt[5] ], {k, 1, 100} ] (* _Federico Provvedi_, Mar 26 2013 *)
%t LinearRecurrence[{0, 2, 1}, {1, 1, 1}, 40] (* _Vincenzo Librandi_, Aug 13 2018 *)
%o (PARI) { for (n=1, 250, if (n>2, a=a1 + a2 + (-1)^n; a2=a1; a1=a, a=a1=1; a=a2=1); write("b066983.txt", n, " ", a) ) } \\ _Harry J. Smith_, Apr 15 2010
%o (PARI) vector(40, n, 2*fibonacci(n-2) + (-1)^n) \\ _G. C. Greubel_, Dec 26 2019
%o (GAP) a:=[1,1];; for n in [3..40] do a[n]:=a[n-1]+a[n-2]+(-1)^n; od; a; # _Muniru A Asiru_, Aug 09 2018
%o (Magma) [n le 2 select 1 else Self(n-1)+Self(n-2)+(-1)^n: n in [1..50]]; // _Vincenzo Librandi_, Aug 13 2018
%o (Sage) [2*fibonacci(n-2) + (-1)^n for n in (1..40)] # _G. C. Greubel_, Dec 26 2019
%Y Cf. A000045, A001083, A042942, A064353.
%K nonn,easy
%O 1,4
%A _Benoit Cloitre_, Jan 27 2002
%E Deleted certain dangerous or potentially dangerous links. - _N. J. A. Sloane_, Jan 30 2021