Mathematica 9 is now available
Student Support Forum
Student Support Forum: ' How to control the format of the answer' topicStudent Support Forum > General > Archives > " How to control the format of the answer"

Next Comment >Help | Reply To Topic
Author Comment/Response
07/08/13 9:40pm

Okay, so, assuming mathematica will work for me someday...

The sum of 1 / ((10^n)-1

looks like 1/9 + 1/99 + 1/999 + ...

and it yields an answer that is an exact fraction (a/b).

Let's say that I know that after adding so many terms,

the first so many digits of the sum will accurately begin to represent the limit of the series

After four terms,

1/9+1/99+1/999+1/9999 = 135754/1109889

which is 0.1223131322141... after 13 decimal places.

It is also 122313132214 / 999999999999 or .122313132214 repeating

Let's say that I know that after n terms,

I would get "n" accurate digits approaching the value of the limit of the series.

After 4 terms, I will get 4 accurate digits.

The answers get extremely long, so it would be nice to be able to discard everything else from the final answer.

In fact, what I would like to see happen is to discard the number on the bottom, or b,

from the final answer altogether, using the logic that any number over the same number of nines

is just the decimal form of "a" repeating. I already have "a" over "b", so why would I need to divide them to get "a" repeating.

This would just be repeating information that I already have.

By doing this, I let the machine avoid having to do that final division

of an incredibly long number by an equally long number.

After knowing that the first four digits of 122313132214 are all I want,

I could let the computer keep 1223 and trash the rest of the data.

I also want to deny the computer the ability

to reduce the fraction of a/b into simplest terms before trashing the rest.

I would like to see the remainder of "a" exported to a .dat file.

And I would like that exported number to be broken up into chunks of a certain size,

and a number to be place along side it that says what number of chunk it is.

As in, ( chunk #, chunk of "a" ) = (x,y)

For example, if n=4, then a=1223. I want this to be exported in chunks of 1,

then the following dat file should look something like this,


Later, I will want to have mathematica automatically search the dat file for instances where

y = 2, and have it return only the chunk #'s for x.

So if I search the above example, I get x = { 2 , 3 ]

I will also need to be able to specify the range of x to search across.

So for n=47, let's say that I and my computer knows what the first prime numbers under ten are.

I then want to tell the computer, give me a list of x values in the range of 10 to 47

where y=2.

I would get : x = {11,13,17,19,23,29,31, ...,47}

and then I would want to save this to a new dat file for sure.

I could get by with exporting the decimal value of the sum, but it would be over trillions of digits long times two.

I know this is a lot to ask for, but I'm sure there is someone out there who knows as much about

mathematica as I do about art.

And it would just be nice to have an optimized code to do this.

URL: ,

Subject (listing for ' How to control the format of the answer')
Author Date Posted
How to control the format of the answer JD 07/08/13 9:40pm
Re: How to control the format of the answer Bill Simpson 07/09/13 5:14pm
Re: How to control the format of the answer Bill Simpson 07/10/13 11:27am
Re: Re: How to control the format of the answer JD 07/25/13 01:00am
Re: Re: Re: How to control the format of the a... Forum Modera... 07/25/13 12:49pm
Next Comment >Help | Reply To Topic