MathGroup Archive 2014

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Goodstein expansion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132325] Re: Goodstein expansion
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 9 Feb 2014 04:49:07 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

On 2/8/14 at 4:02 AM, Roberto.Brambilla at rse-web.it (Brambilla Roberto
Luigi (RSE)) wrote:

>The Goodstein expansion of integers  (see for instance  Stillwell,"
>Roads to Infinity", pag.47)

>Given an integer n we can write it as sum of powers of  2

>87=2^6+2^4+2^2+1=2^(2^2+2)+2^(2^2)+2^2+2^0

>More generally assuming an integer b as a base, we can write  n as a
>sum of power of b with coefficients <b es.:  b=5

>87=3*5^2+2*5^1+2*5^0.

>I can do it by means of a long and obvious routine with lots 
>of If[]  and While[]. May be someone can do it by means of the
>recursive properties of Mathematica language?

Since this is nothing more than expressing an integer in a
different base, built in functions will do what you want

That is

In[1]:= IntegerDigits[87, 5]

Out[1]= {3,2,2}

and

In[2]:= IntegerDigits[87, 2]

Out[2]= {1,0,1,0,1,1,1}

And if you want a list of powers for the base

In[3]:= d = IntegerDigits[87, 2];
Pick[Range[Length@d] - 1, Unitize[Reverse@d], 1]

Out[4]= {0,1,2,4,6}

and

In[5]:= d = IntegerDigits[87, 5];
Pick[Range[Length@d] - 1, Unitize[Reverse@d], 1]

Out[6]= {0,1,2}




  • Prev by Date: Re: Goodstein expansion
  • Next by Date: Re: Memory leaks problem
  • Previous by thread: Re: Goodstein expansion
  • Next by thread: R: Re: Goodstein expansion