cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A020985 The Rudin-Shapiro or Golay-Rudin-Shapiro sequence (coefficients of the Shapiro polynomials).

Original entry on oeis.org

1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1
Offset: 0

Views

Author

Keywords

Comments

Other names are the Rudin-Shapiro or Golay-Rudin-Shapiro infinite word.
The Shapiro polynomials are defined by P_0 = Q_0 = 1; for n>=0, P_{n+1} = P_n + x^(2^n)*Q_n, Q_{n+1} = P_n - x^(2^n)*Q_n. Then P_n = Sum_{m=0..2^n-1} a(m)*x^m, where the a(m) (the present sequence) do not depend on n. - N. J. A. Sloane, Aug 12 2016
Related to paper-folding sequences - see the Mendès France and Tenenbaum article.
a(A022155(n)) = -1; a(A203463(n)) = 1. - Reinhard Zumkeller, Jan 02 2012
a(n) = 1 if and only if the numbers of 1's and runs of 1's in binary representation of n have the same parity: A010060(n) = A268411(n); otherwise, when A010060(n) = 1 - A268411(n), a(n) = -1. - Vladimir Shevelev, Feb 10 2016. Typo corrected and comment edited by Antti Karttunen, Jul 11 2017
A word that is uniform primitive morphic, but not pure morphic. - N. J. A. Sloane, Jul 14 2018
Named after the Austrian-American mathematician Walter Rudin (1921-2010), the mathematician Harold S. Shapiro (1928-2021) and the Swiss mathematician and physicist Marcel Jules Edouard Golay (1902-1989). - Amiram Eldar, Jun 13 2021

References

  • Jean-Paul Allouche and Jeffrey Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 78 and many other pages.

Crossrefs

Cf. A022155, A005943 (factor complexity), A014081.
Cf. A020987 (0-1 version), A020986 (partial sums), A203531 (run lengths), A033999, A380667 (first differences).
Sequences mentioned in the Allouche et al. "Taxonomy" paper, listed by example number: 1: A003849, 2: A010060, 3: A010056, 4: A020985 and A020987, 5: A191818, 6: A316340 and A273129, 18: A316341, 19: A030302, 20: A063438, 21: A316342, 22: A316343, 23: A003849 minus its first term, 24: A316344, 25: A316345 and A316824, 26: A020985 and A020987, 27: A316825, 28: A159689, 29: A049320, 30: A003849, 31: A316826, 32: A316827, 33: A316828, 34: A316344, 35: A043529, 36: A316829, 37: A010060.

Programs

  • Haskell
    a020985 n = a020985_list !! n
    a020985_list = 1 : 1 : f (tail a020985_list) (-1) where
       f (x:xs) w = x : x*w : f xs (0 - w)
    -- Reinhard Zumkeller, Jan 02 2012
    
  • Maple
    A020985 := proc(n) option remember; if n = 0 then 1 elif n mod 2 = 0 then A020985(n/2) else (-1)^((n-1)/2 )*A020985( (n-1)/2 ); fi; end;
  • Mathematica
    a[0] = 1; a[1] = 1; a[n_?EvenQ] := a[n] = a[n/2]; a[n_?OddQ] := a[n] = (-1)^((n-1)/2)* a[(n-1)/2]; a /@ Range[0, 80] (* Jean-François Alcover, Jul 05 2011 *)
    a[n_] := 1 - 2 Mod[Length[FixedPointList[BitAnd[#, # - 1] &, BitAnd[n, Quotient[n, 2]]]], 2] (* Jan Mangaldan, Jul 23 2015 *)
    Array[RudinShapiro, 81, 0] (* JungHwan Min, Dec 22 2016 *)
  • PARI
    A020985(n)=(-1)^A014081(n)  \\ M. F. Hasler, Jun 06 2012
    
  • Python
    def a014081(n): return sum([((n>>i)&3==3) for i in range(len(bin(n)[2:]) - 1)])
    def a(n): return (-1)**a014081(n) # Indranil Ghosh, Jun 03 2017
    
  • Python
    def A020985(n): return -1 if (n&(n>>1)).bit_count()&1 else 1 # Chai Wah Wu, Feb 11 2023

Formula

a(0) = a(1) = 1; thereafter, a(2n) = a(n), a(2n+1) = a(n) * (-1)^n. [Brillhart and Carlitz, in proof of theorem 4]
a(0) = a(1) = 1, a(2n) = a(n), a(2n+1) = a(n)*(1-2*(n AND 1)), where AND is the bitwise AND operator. - Alex Ratushnyak, May 13 2012
Brillhart and Morton (1978) list many properties.
a(n) = (-1)^A014081(n) = (-1)^A020987(n) = 1-2*A020987(n). - M. F. Hasler, Jun 06 2012
Sum_{n >= 1} a(n-1)*(8*n^2+4*n+1)/(2*n*(2*n+1)*(4*n+1)) = 1; see Allouche and Sondow, 2015. - Jean-Paul Allouche and Jonathan Sondow, Mar 21 2015

A005942 a(2n) = a(n) + a(n+1), a(2n+1) = 2a(n+1), if n >= 2.

Original entry on oeis.org

1, 2, 4, 6, 10, 12, 16, 20, 22, 24, 28, 32, 36, 40, 42, 44, 46, 48, 52, 56, 60, 64, 68, 72, 76, 80, 82, 84, 86, 88, 90, 92, 94, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182
Offset: 0

Views

Author

Keywords

Comments

a(n) is the subword complexity (or factor complexity) of Thue-Morse sequence A010060, that is, the number of factors of length n in A010060. See Allouche-Shallit (2003). - N. J. A. Sloane, Jul 10 2012

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003. See Problem 10, p. 335. - From N. J. A. Sloane, Jul 10 2012
  • J. Berstel et al., Combinatorics on Words: Christoffel Words and Repetitions in Words, Amer. Math. Soc., 2008. See p. 83.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a005942 n = a005942_list !! n
    a005942_list = 1 : 2 : 4 : 6 : zipWith (+) (drop 6 ts) (drop 5 ts) where
       ts = concat $ transpose [a005942_list, a005942_list]
    -- Reinhard Zumkeller, Nov 15 2012
  • Mathematica
    a[0] = 1; a[1] = 2; a[2] = 4; a[3] = 6; a[n_?EvenQ] := a[n] = a[n/2] + a[n/2 + 1]; a[n_?OddQ]  := a[n] = 2*a[(n + 1)/2]; Array[a,60,0] (* Jean-François Alcover, Apr 11 2011 *)
  • PARI
    a(n)=if(n<4,2*max(0,n)+(n==0),if(n%2,2*a((n+1)/2),a(n/2)+a(n/2+1)))
    

Formula

a(n) = 2*(A006165(n-1) + n - 1), n > 1.
G.f. (1+x^2)/(1-x)^2 + 2*x^2/(1-x)^2 * Sum_{k>=0} (x^2^(k+1)-x^(3*2^k)). - Ralf Stephan, Jun 04 2003
For n > 2, a(n) = 3*(n-1) + A053646(n-1). - Max Alekseyev, May 15 2011
a(n) = 2*A275202(n-1) for n > 1. - N. J. A. Sloane, Jun 04 2019

Extensions

Typo in definition corrected by Reinhard Zumkeller, Nov 15 2012

A006697 Number of subwords of length n in infinite word generated by a -> aab, b -> b.

Original entry on oeis.org

1, 2, 4, 6, 9, 13, 17, 22, 28, 35, 43, 51, 60, 70, 81, 93, 106, 120, 135, 151, 167, 184, 202, 221, 241, 262, 284, 307, 331, 356, 382, 409, 437, 466, 496, 527, 559, 591, 624, 658, 693, 729, 766, 804, 843, 883, 924, 966, 1009, 1053, 1098, 1144, 1191, 1239
Offset: 0

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    A103354[n_] := Floor[ FullSimplify[ ProductLog[ 2^n*Log[2]]/Log[2]]]; Accumulate[ Table[ A103354[n], {n, 1, 54}]] (* Jean-François Alcover, Dec 13 2011, after M. F. Hasler *)
  • PARI
    LambertW(y) = solve( X=1,log(y), X*exp(X)-y)
    A006697(n,b=2)=local(m=floor(n+1-LambertW(b^(n+1)*log(b))/log(b)));(b^(m+1)-1)/(b-1)+(n-m)*(n-m+1)/2 \\ M. F. Hasler, Dec 14 2007

Formula

G.f.: 1 + 1/(1-x) + 1/(1-x)^2 * [1/(1-x) - sum(k>=1, x^(2^k+k-1))] (conjectured). - Ralf Stephan, Mar 05 2004
Conjectures: partial sums of A103354, also equal to A094913(n) + 1. - Vladeta Jovovic, Sep 19 2005
a(n) = sum(k=0,n,min(2^k,n-k+1)) = 2^(m+1)-1 + (n-m)(n-m+1)/2 with m = [ n+1-LambertW( 2^(n+1) * log(2) ) / log(2) ] = integer part of the solution to 2^m = n+1-m. (conjectured). - M. F. Hasler, Dec 14 2007

Extensions

More terms from Michel ten Voorde, Apr 11 2001

A337120 Factor complexity (number of subwords of length n) of the regular paperfolding sequence (A014577), and all generalized paperfolding sequences.

Original entry on oeis.org

1, 2, 4, 8, 12, 18, 23, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228
Offset: 0

Views

Author

Kevin Ryde, Aug 17 2020

Keywords

Examples

			For n=4, all length 4 subwords except 0000, 0101, 1010, 1111 occur, so a(4) = 16-4 = 12.  (These words do not occur because odd terms in a paperfolding sequence alternate, so a subword wxyz must have w!=y or x!=z.)
		

Crossrefs

Cf. A014577, A214613 (Abelian complexity), A333994 (arithmetical complexity).
Cf. A005943 (GRS).

Programs

  • Mathematica
    LinearRecurrence[{2, -1}, {1, 2, 4, 8, 12, 18, 23, 28, 32}, 100] (* Paolo Xausa, Feb 29 2024 *)
  • PARI
    Vec((1 + x^2)*(1 + 2*x^3 - x^6) / (1 - x)^2 + O(x^50)) \\ Colin Barker, Sep 08 2020

Formula

a(1..6) = 2,4,8,12,18,23, then a(n) = 4*n for n>=7. [Allouche]
From Colin Barker, Sep 05 2020: (Start)
G.f.: (1 + x^2)*(1 + 2*x^3 - x^6) / (1 - x)^2.
a(n) = 2*a(n-1) - a(n-2) for n>8.
(End)
Showing 1-4 of 4 results.