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

A007400 Continued fraction for Sum_{n>=0} 1/2^(2^n) = 0.8164215090218931...

Original entry on oeis.org

0, 1, 4, 2, 4, 4, 6, 4, 2, 4, 6, 2, 4, 6, 4, 4, 2, 4, 6, 2, 4, 4, 6, 4, 2, 6, 4, 2, 4, 6, 4, 4, 2, 4, 6, 2, 4, 4, 6, 4, 2, 4, 6, 2, 4, 6, 4, 4, 2, 6, 4, 2, 4, 4, 6, 4, 2, 6, 4, 2, 4, 6, 4, 4, 2, 4, 6, 2, 4, 4, 6, 4, 2, 4, 6, 2, 4, 6, 4, 4, 2, 4, 6, 2, 4, 4, 6, 4, 2, 6, 4, 2, 4, 6, 4, 4, 2, 6, 4
Offset: 0

Views

Author

Keywords

Examples

			0.816421509021893143708079737... = 0 + 1/(1 + 1/(4 + 1/(2 + 1/(4 + ...))))
		

References

  • M. Kmošek, Rozwinieçie Niektórych Liczb Niewymiernych na Ulamki Lancuchowe (Continued Fraction Expansion of Some Irrational Numbers), Master's thesis, Uniwersytet Warszawski, 1979.

Crossrefs

Cf. A007404 (decimal), A073088 (partial sums), A073414/A073415 (convergents), A088431 (half), A089267, A092910.

Programs

  • Maple
    a:= proc(n) option remember; local n8, n16;
        n8:= n mod 8;
        if n8 = 0 or n8 = 3 then return 2
        elif n8 = 4 or n8 = 7 then return 4
        elif n8 = 1 then return procname((n+1)/2)
        elif n8 = 2 then return procname((n+2)/2)
        fi;
        n16:= n mod 16;
        if n16 = 5 or n16 = 14 then return 4
        elif n16 = 6 or n16 = 13 then return 6
        fi
    end proc:
    a(0):= 0: a(1):= 1: a(2):= 4:
    map(a, [$0..1000]); # Robert Israel, Jun 14 2016
  • Mathematica
    a[n_] := a[n] = Which[n < 3, {0, 1, 4}[[n+1]], Mod[n, 8] == 1, a[(n+1)/2], Mod[n, 8] == 2, a[(n+2)/2], True, {2, 0, 0, 2, 4, 4, 6, 4, 2, 0, 0, 2, 4, 6, 4, 4}[[Mod[n, 16]+1]]]; Table[a[n], {n, 0, 98}] (* Jean-François Alcover, Nov 29 2013, after Ralf Stephan *)
  • PARI
    a(n)=if(n<3,[0,1,4][n+1],if(n%8==1,a((n+1)/2),if(n%8==2,a((n+2)/2),[2,0,0,2,4,4,6,4,2,0,0,2,4,6,4,4][(n%16)+1]))) /* Ralf Stephan */
    
  • PARI
    a(n)=contfrac(suminf(n=0,1/2^(2^n)))[n+1]
    
  • PARI
    { allocatemem(932245000); default(realprecision, 26000); x=suminf(n=0, 1/2^(2^n)); x=contfrac(x); for (n=1, 20001, write("b007400.txt", n-1, " ", x[n])); } \\ Harry J. Smith, May 07 2009
    
  • Scheme
    (define (A007400 n) (cond ((<= n 1) n) ((= 2 n) 4) (else (case (modulo n 8) ((0 3) 2) ((4 7) 4) ((1) (A007400 (/ (+ 1 n) 2))) ((2) (A007400 (/ (+ 2 n) 2))) (else (case (modulo n 16) ((5 14) 4) ((6 13) 6))))))) ;; (After Ralf Stephan's recurrence) - Antti Karttunen, Aug 12 2017

Formula

From Ralf Stephan, May 17 2005: (Start)
a(0)=0, a(1)=1, a(2)=4; for n > 2:
a(8k) = a(8k+3) = 2;
a(8k+4) = a(8k+7) = a(16k+5) = a(16k+14) = 4;
a(16k+6) = a(16k+13) = 6;
a(8k+1) = a(4k+1);
a(8k+2) = a(4k+2). (End)

A014707 a(4n) = 0, a(4n+2) = 1, a(2n+1) = a(n).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The regular paper-folding (or dragon curve) sequence.
It appears that the sequence of run lengths is A088431. - Dimitri Hendriks, May 06 2010
Runs of three consecutive ones appear around positions n = 22, 46, 54, 86, 94, 118, 150, 174, 182, ..., or for n of the form 2^(k+3)*(4*t+3)-2, k >= 0, t >= 0. - Vladimir Shevelev, Mar 19 2011

References

  • Guy Melançon, Factorizing infinite words using Maple, MapleTech journal, Vol. 4, No. 1, 1997, pp. 34-42, esp. p. 36.

Crossrefs

Equals 1 - A014577, which see for further references. Also a(n) = A038189(n+1).
The following are all essentially the same sequence: A014577, A014707, A014709, A014710, A034947, A038189, A082410.

Programs

  • Haskell
    a014707 n = a014707_list !! n
    a014707_list = f 0 $ cycle [0,0,1,0] where
       f i (x:_:xs) = x : a014707 i : f (i+1) xs
    -- Reinhard Zumkeller, Sep 28 2011
    
  • Maple
    nmax:=92: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 0 to ceil(nmax/(p+2))+1 do a((2*n+1)*2^p-1) := n mod 2 od: od: seq(a(n), n=0..nmax); # Johannes W. Meijer, Jan 28 2013
    # second Maple program:
    a:= proc(n) option remember;
         `if`(n::even, irem(n/2, 2), a((n-1)/2))
        end:
    seq(a(n), n=0..92);  # Alois P. Heinz, Jun 27 2022
  • Mathematica
    a[n_ /; Mod[n, 4] == 0] = 0; a[n_ /; Mod[n, 4] == 2] = 1; a[n_ /; Mod[n, 2] == 1] := a[n] = a[(n - 1)/2]; Table[a[n],{n,0,92}] (* Jean-François Alcover, May 17 2011 *)
    (1 - JacobiSymbol[-1, Range[100]])/2 (* Paolo Xausa, May 26 2024 *)
  • PARI
    a(n)=n+=1;my(h=bitand(n,-n));n=bitand(n,h<<1);n!=0; \\ Joerg Arndt, Apr 09 2021
  • Python
    def A014707(n):
        s = bin(n+1)[2:]
        m = len(s)
        i = s[::-1].find('1')
        return int(s[m-i-2]) if m-i-2 >= 0 else 0 # Chai Wah Wu, Apr 08 2021
    
  • Python
    def A014707(n): n+=1; h=n&-n; n=n&(h<<1); return int(n!=0)
    print([A014707(n) for n in range(93)]) # Michael S. Branicky, Mar 29 2024 after Joerg Arndt
    

Formula

a(A091072(n)-1) = 0; a(A091067(n)-1) = 1. - Reinhard Zumkeller, Sep 28 2011 [Adjusted to match offset by Peter Munn, Jul 01 2022]
a(n) = (1-Jacobi(-1,n+1))/2 (cf. A034947). - N. J. A. Sloane, Jul 27 2012 [Adjusted to match offset by Peter Munn, Jul 01 2022]
Set a=0, b=1, S(0)=a, S(n+1) = S(n)aF(S(n)), where F(x) reverses x and then interchanges a and b; sequence is limit S(infinity).
a((2*n+1)*2^p-1) = n mod 2, p >= 0. - Johannes W. Meijer, Jan 28 2013
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - Amiram Eldar, Aug 31 2024

Extensions

More terms from Scott C. Lindhurst (ScottL(AT)alumni.princeton.edu)

A092910 a(n) is the (3n+2)-th component of the continued fraction for sum(k>=0,2^(-k!)).

Original entry on oeis.org

3, 4, 3, 3, 2, 3, 4, 3, 2, 4, 3, 2, 3, 3, 4, 3, 2, 4, 3, 3, 2, 3, 4, 2, 3, 4, 3, 2, 3, 3, 4, 3, 2, 4, 3, 3, 2, 3, 4, 3, 2, 4, 3, 2, 3, 3, 4, 2, 3, 4, 3, 3, 2, 3, 4, 2, 3, 4, 3, 2, 3, 3, 4, 3, 2, 4, 3, 3, 2, 3, 4, 3, 2, 4, 3, 2, 3, 3, 4, 3, 2, 4, 3, 3, 2, 3, 4, 2, 3, 4, 3, 2, 3, 3, 4, 2, 3, 4, 3, 3, 2, 3, 4, 3, 2
Offset: 0

Views

Author

Benoit Cloitre, Apr 16 2004

Keywords

Crossrefs

Programs

  • PARI
    a(n)=5-component(contfrac(sum(i=0,10,1/2^(2^i))),n+3)/2
    
  • Scheme
    (define (A092910 n) (- 5 (* 1/2 (A007400 (+ 2 n))))) ;;  Code for A007400 given under that entry. - Antti Karttunen, Aug 12 2017

Formula

a(n) = 5 - (A007400(n+2)/2).

A088435 1/2 + half of the (n+1)-st component of the continued fraction expansion of sum(k>=1,1/3^(2^k)).

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Nov 08 2003

Keywords

Comments

To construct the sequence use the rule : a(1)=3, then a(a(1)+a(2)+...+a(n)+1)=2+(-1)^n and fill in any undefined place with 2.

Examples

			Example to illustrate the comment : a(a(1)+1) = a(4) = 2+(-1)^1 = 1 and a(2), a(3) are undefined. The rule forces a(2) = a(3) = 2.
		

Crossrefs

Cf. A088431.

Formula

a(n) = (1/2) * (1+A004200(n+1)).
a(a(1)+a(2)+...+a(n)+1) = 2+(-1)^n.

A381929 Ending positions of runs in the regular paperfolding sequence A034947.

Original entry on oeis.org

2, 3, 5, 7, 10, 12, 13, 15, 18, 19, 21, 24, 26, 28, 29, 31, 34, 35, 37, 39, 42, 44, 45, 48, 50, 51, 53, 56, 58, 60, 61, 63, 66, 67, 69, 71, 74, 76, 77, 79, 82, 83, 85, 88, 90, 92, 93, 96, 98, 99, 101, 103, 106, 108, 109, 112, 114, 115, 117, 120, 122, 124, 125
Offset: 1

Views

Author

Jeffrey Shallit, Mar 10 2025

Keywords

Comments

A "run" is a maximal block of consecutive identical terms.

Examples

			The first few terms of A034947 are 1,1,-1,1,1,-1,-1,1,1,1,-1, and the runs end at positions 2,3,5,7,10,... .
		

Crossrefs

Cf. A034947. A371594 gives the starting positions of the runs, and A088431 gives the length of the runs.
Showing 1-5 of 5 results.