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.

A001468 There are a(n) 2's between successive 1's.

Original entry on oeis.org

1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2
Offset: 0

Views

Author

Keywords

Comments

The Fibonacci word on the alphabet {2,1}, with an extra 1 in front. - Michel Dekking, Nov 26 2018
Start with 1, apply 1->12, 2->122, take limit. - Philippe Deléham, Sep 23 2005
Also number of occurrences of n in Hofstadter G-sequence (A005206) and in A019446. - Reinhard Zumkeller, Feb 02 2012, Aug 07 2011
A block-fractal sequence: every block occurs infinitely many times. Also a reverse block-fractal sequence. See A280511. - Clark Kimberling, Jan 06 2017

References

  • D. Gault and M. Clint, "Curiouser and curiouser" said Alice. Further reflections on an interesting recursive function, Internat. J. Computer Math., 26 (1988), 35-43. See Table 2.
  • D. R. Hofstadter, personal communication, Jul 15 1977.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Same as A014675 if initial 1 is deleted. Cf. A003849, A000201, A280511.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A000201 as the parent: A000201, A001030, A001468, A001950, A003622, A003842, A003849, A004641, A005614, A014675, A022342, A088462, A096270, A114986, A124841. - N. J. A. Sloane, Mar 11 2021

Programs

  • Haskell
    import Data.List (group)
    a001468 n = a001468_list !! n
    a001468_list = map length $ group a005206_list
    -- Reinhard Zumkeller, Aug 07 2011
    
  • Maple
    Digits := 100: t := evalf( (1+sqrt(5))/2); A001468 := n-> floor((n+1)*t)-floor(n*t);
  • Mathematica
    Table[Floor[GoldenRatio*(n + 1)] - Floor[GoldenRatio*n], {n, 0, 80}] (* Joseph Biberstine (jrbibers(AT)indiana.edu), Aug 14 2006 *)
    Nest[ Flatten[# /. {1 -> {1, 2}, 2 -> {1, 2, 2}}] &, {1}, 6] (* Robert G. Wilson v, May 20 2014 and corrected Apr 24 2017 following Clark Kimberling's email of Mar 22 2017 *)
    SubstitutionSystem[{1->{1,2},2->{1,2,2}},{1},{6}][[1]] (* Harvey P. Dale, Jan 31 2022 *)
  • PARI
    a=[1];for(i=1,30,a=concat([a,vector(a[i],j,2),1]));a \\ Or compute as A001468(n)=A201(n+1)-A201(n) with A201(n)=(n+sqrtint(5*n^2))\2, working for n>=0 although A000201 is defined for n>=1. - M. F. Hasler, Oct 13 2017
    
  • Python
    def A001468(length):
        a = [1]
        for i in range(length):
            for _ in range(a[i]):
                a.append(2)
            a.append(1)
            if len(a)>=length:
                break
        return a[:length] # Nicholas Stefan Georgescu, Jun 02 2022
    
  • Python
    from math import isqrt
    def A001468(n): return (n+1+isqrt(m:=5*(n+1)**2)>>1)-(n+isqrt(m-10*n-5)>>1) # Chai Wah Wu, Aug 25 2022

Formula

a(n) = [(n+1) tau] - [n tau], tau = (1 + sqrt 5)/2 = A001622, [] = floor function.
a(n) = A000201(n+1) - A000201(n) = A022342(n+1) - A022342(n), n >= 1; i.e., the first term discarded, this yields the first differences of A000201 and A022342. - M. F. Hasler, Oct 13 2017

Extensions

Rechecked by N. J. A. Sloane, Nov 07 2001