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-2 of 2 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)

A073089 a(n) = (1/2)*(4n - 3 - Sum_{k=1..n} A007400(k)).

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Aug 18 2002

Keywords

Comments

From Joerg Arndt, Oct 28 2013: (Start)
Sequence is (essentially) obtained by complementing every other term of A014577.
Turns (by 90 degrees) of a curve similar to the Heighway dragon which can be rendered as follows: [Init] Set n=0 and direction=0. [Draw] Draw a unit line (in the current direction). Turn left/right if a(n) is zero/nonzero respectively. [Next] Set n=n+1 and goto (draw).
See the linked pdf files for two renderings of the curve. (End)

Examples

			From _Paul D. Hanna_, Oct 19 2012: (Start)
Let F(x) = x + 1/x + 1/x^3 + 1/x^7 + 1/x^15 + 1/x^31 +...+ 1/x^(2^n-1) +...
then F(x) = x + 1/(x + 1/(-x + 1/(-x + 1/(-x + 1/(x + 1/(x + 1/(-x + 1/(-x + 1/(x + 1/(-x + 1/(-x + 1/(x + 1/(x + 1/(x + 1/(-x + 1/(-x + 1/(x + 1/(-x + 1/(-x + 1/(-x + 1/(x +...+ 1/((-1)^a(n)*x +...)))))))))))))))))))))),
a continued fraction in which the partial quotients equal (-1)^a(n)*x.  (End)
		

Crossrefs

Cf. A007400, A073088 (the sum part here), A123725.

Programs

  • PARI
    a(n)=if(n<2,0,if(n%8==1,a((n+1)/2),[1,-1,0,1,1,1,0,0,1,-1,0,1,1,0,0,0][(n%16)+1])) \\ Ralf Stephan
    
  • PARI
    /* Using the Continued Fraction, Print 2^N terms of this sequence: */
    {N=10;CF=contfrac(x+sum(n=1,N,1/x^(2^n-1)),2^N);for(n=1,2^N,print1((1-CF[n]/x)/2,", "))} \\ Paul D. Hanna, Oct 19 2012
    
  • PARI
    a(n) = { if ( n<=1, return(0)); n-=1; my(v=2^valuation(n,2) ); return( (0==bitand(n, v<<1)) != (v%2) ); } \\ Joerg Arndt, Oct 28 2013

Formula

Recurrence: a(1) = a(4n+2) = a(8n+7) = a(16n+13) = 0, a(4n) = a(8n+3) = a(16n+5) = 1, a(8n+1) = a(4n+1).
G.f.: The following series has a simple continued fraction expansion:
x + Sum_{n>=1} 1/x^(2^n-1) = [x; x, -x, -x, -x, x, ..., (-1)^a(n)*x, ...]. - Paul D. Hanna, Oct 19 2012
a(n) = A014577(n-2) + A056594(n). Conjecture: a(n) = (1 + (-1)^A057661(n - 1))/2 for all n > 1. - Velin Yanev, Feb 01 2021
Showing 1-2 of 2 results.