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-6 of 6 results.

A095774 a(n)=2*A003160(n)-n.

Original entry on oeis.org

1, 0, -1, 0, 1, 2, 1, 0, 1, 0, -1, 0, -1, -2, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 0, -1, 0, -1, -2, -1, 0, 1, 0, -1, 0, -1, -2, -1, -2, -3, -2, -1, 0, -1, -2, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 0, -1, 0, -1, -2, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2
Offset: 1

Views

Author

Benoit Cloitre, Jun 05 2004

Keywords

Programs

  • Haskell
    a095774 n = 2 * a003160 n - n  -- Reinhard Zumkeller, Aug 02 2013
  • PARI
    m=1106;v=vector(m,j,1);for(n=3,m,g=n-v[v[n-1]]-v[v[n-2]];v[n]=g);a(n)=2*v[n]-n
    

Extensions

Offset corrected by Reinhard Zumkeller, Aug 02 2013

A095775 n/2 when 2*A003160(n) = n.

Original entry on oeis.org

1, 2, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 21, 22, 24, 25, 26, 30, 32, 33, 34, 36, 37, 38, 40, 41, 42, 44, 48, 49, 50, 52, 60, 64, 65, 66, 68, 69, 70, 72, 73, 74, 76, 80, 81, 82, 84, 85, 86, 88, 89, 90, 94, 96, 97, 98, 100, 101, 102, 104, 105, 106, 110, 118, 120, 121, 122
Offset: 1

Views

Author

Benoit Cloitre, Jun 05 2004

Keywords

Crossrefs

Cf. A095774.

Programs

  • Haskell
    a095775 n = a095775_list !! (n-1)
    a095775_list = map (`div` 2) $ filter ((== 0) . a095774) [1..]
    -- Reinhard Zumkeller, Aug 02 2013

A080426 a(1)=1, a(2)=3; all terms are either 1 or 3; each run of 3's is followed by a run of two 1's; and a(n) is the length of the n-th run of 3's.

Original entry on oeis.org

1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1
Offset: 1

Views

Author

John W. Layman, Feb 18 2003

Keywords

Comments

It appears that the sequence can be calculated by any of the following three methods: (1) Start with 1 and repeatedly replace (simultaneously) all 1's with 1,3,1 and all 3's with 1,3,3,3,1. [Equivalently, trajectory of 1 under the morphism 1 -> 1,3,1; 3 -> 1,3,3,3,1. - N. J. A. Sloane, Nov 03 2019] (2) a(n)= A026490(2n). (3) Replace each 2 in A026465 (run lengths in Thue-Morse) with 3.
Length of n-th run of 1's in the Feigenbaum sequence A035263 = 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, .... - Philippe Deléham, Apr 18 2004
Another construction. Let S_0 = 1, and let S_n be obtained by applying the morphism 1 -> 3, 3 -> 113 to S_{n-1}. The sequence is the concatenation S_0, S_1, S_2, ... - D. R. Hofstadter, Oct 23 2014
a(n+1) is the number of times n appears in A003160. - John Keith, Dec 31 2020

Crossrefs

Arises in the analysis of A075326, A249031 and A249032.

Programs

  • Haskell
    -- following Deléham
    import Data.List (group)
    a080426 n = a080426_list !! n
    a080426_list = map length $ filter ((== 1) . head) $ group a035263_list
    -- Reinhard Zumkeller, Oct 27 2014
    
  • Mathematica
    Position[ Nest[ Flatten[# /. {0 -> {0, 2, 1}, 1 -> {0}, 2 -> {0}}]&, {0}, 8], 0] // Flatten // Differences // Prepend[#, 1]& (* Jean-François Alcover, Mar 14 2014, after Philippe Deléham *)
    nsteps=7;Flatten[SubstitutionSystem[{1->{3},3->{1,1,3}},{1},nsteps]] (* Paolo Xausa, Aug 12 2022, using D. R. Hofstadter's construction *)
  • PARI
    A080426(nmax) = my(a=[1], s=[[1, 3, 1], [], [1, 3, 3, 3, 1]]); while(length(a)A080426(100) \\ Paolo Xausa, Sep 14 2022, using method (1) from comments
    
  • Python
    def A080426(nmax):
        a, s = "1", "".maketrans({"1":"131", "3":"13331"})
        while len(a) < nmax: a = a.translate(s)
        return list(map(int, a[:nmax]))
    print(A080426(100)) # Paolo Xausa, Aug 30 2022, using method (1) from comments
    
  • Python
    def A080426(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(lambda x:f(x)+n,n,n)-bisection(lambda x:f(x)+n-1,n-1,n-1)-1 # Chai Wah Wu, Jan 29 2025

Formula

a(1) = 1; for n>1, a(n) = A003156(n) - A003156(n-1). - Philippe Deléham, Apr 16 2004

A287422 a(1) = a(2) = 1; a(n) = n - a(a(n-1)) - a(n-a(n-1)) for n > 2.

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 5, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 13, 13, 14, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 19, 19, 19, 19, 20, 21, 21, 22, 22, 22, 23, 24, 25, 25, 26, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 40, 41, 42, 42, 42, 43, 44, 45, 46, 46
Offset: 1

Views

Author

Altug Alkan, Jun 24 2017

Keywords

Crossrefs

Programs

  • Magma
    I:=[1,1,1,2]; [n le 4 select I[n] else n - Self(Self(n-1)) - Self(n-Self(n-1)): n in [1..100]]; // Vincenzo Librandi, Aug 08 2018
  • Mathematica
    Nest[Function[{a, n}, Append[a, n - a[[a[[-1]] ]] - a[[-a[[-1]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, 80] (* Michael De Vlieger, Aug 07 2018 *)
  • PARI
    q=vector(10000); q[1]=q[2]=1; for(n=3, #q, q[n]=n-q[q[n-1]]-q[n-q[n-1]]); q
    

A308818 a(n) = a(a(n-1) mod n) + a(a(n-2) mod n) with a(0)=2 and a(1)=3.

Original entry on oeis.org

2, 3, 5, 7, 10, 7, 13, 15, 22, 23, 12, 6, 15, 18, 13, 25, 41, 37, 10, 22, 17, 40, 47, 40, 81, 38, 22, 53, 85, 134, 51, 29, 156, 215, 23, 47, 46, 35, 69, 98, 144, 81, 108, 116, 102, 37, 47, 37, 72, 75, 85, 104, 217, 111, 10, 15, 37, 60, 40, 147, 197, 51, 110
Offset: 0

Views

Author

Arran Ireland, Jun 26 2019

Keywords

Comments

a(0) and a(1) are chosen to be the smallest starting numbers greater than 1 that are believed to result in a sequence that doesn't cycle.
Empirical observation of the first 10^8 terms suggests that the sequence doesn't enter a cycle.
Conjectures: (i) This sequence doesn't enter a cycle. (ii) There is an integer greater than 1 that can never appear in this sequence.

Examples

			a(2) = a(a(2-1) mod 2) + a(a(2-2) mod 2) = a(a(1) mod 2) + a(a(0) mod 2) = a(3 mod 2) + a(2 mod 2) = a(1) + a(0) = 3 + 2 = 5.
		

Crossrefs

Cf. A000027 (if a(0)=1 and a(1)=2).

Programs

  • Python
    a = [2, 3]
    for n in range(2, 10**4 + 3):
        a.append(a[(a[n - 1] % n)] + a[(a[n - 2] % n)])
        print((n - 2), ",", a[n - 2], sep="")

A078474 a(1)=a(2)=a(3)=1, a(n)=n-a(a(n-1))-a(a(n-2))-a(a(n-3)).

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 10, 11, 12, 12, 12, 12, 13, 14, 15, 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 29, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 02 2003

Keywords

Comments

Conjecture: partial sums of A284680 (verified for n <= 100000). - Sean A. Irvine, Jul 16 2022

Crossrefs

Showing 1-6 of 6 results.