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.

A014012 Engel expansion of 1/Pi.

This page as a plain text file.
%I A014012 #24 Apr 23 2016 14:31:11
%S A014012 4,4,11,45,70,1111,4423,5478,49340,94388,200677,308749,708066,711391,
%T A014012 1113024,4342375,4529119,8061070,12060867,56215509,69737317,124001030,
%U A014012 214920537,471564389,891380746,4293367334,5031151602,9832878719,15034446439,15481444638
%N A014012 Engel expansion of 1/Pi.
%H A014012 Simon Plouffe, <a href="/A014012/b014012.txt">Table of n, a(n) for n = 1..973</a> [Terms 1 through 300 were computed by T. D. Noe]
%H A014012 <a href="/index/El#Engel">Index entries for sequences related to Engel expansions</a>
%p A014012 a(n):=proc(s)
%p A014012 local
%p A014012 i, j, max, aa, bb, lll, prod, S, T, kk;
%p A014012     S := evalf(abs(s));
%p A014012     max := 10^(Digits - 10);
%p A014012     prod := 1;
%p A014012     lll := [];
%p A014012     while prod <= max do
%p A014012         T := 1 + trunc(1/S);
%p A014012         S := frac(S*T);
%p A014012         lll := [op(lll), T];
%p A014012         prod := prod*T
%p A014012     end do;
%p A014012     RETURN(lll)
%p A014012 end;
%p A014012 ### Enter a real number and the program will return the Engel expansion of that number, the number of terms is adjusted to the output
%p A014012 # _Simon Plouffe_, Apr 23 2016
%t A014012 EngelExp[A_,n_]:=Join[Array[1&,Floor[A]],First@Transpose@NestList[{Ceiling[1/Expand[ #[[1]]#[[2]]-1]],Expand[ #[[1]]#[[2]]-1]}&,{Ceiling[1/(A-Floor[A])],A-Floor[A]},n-1]]; EngelExp[N[1/Pi,7! ],50] (* _Vladimir Joseph Stephan Orlovsky_, Jun 08 2009 *)
%Y A014012 See A006784 for definition.
%K A014012 nonn
%O A014012 1,1
%A A014012 _Simon Plouffe_