Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [digits]

Questions dealing with the manipulation of the digits of numbers, including the functions RealDigits and IntegerDigits.

7
votes
3answers
303 views

How Create a list of the first 10,000 digits of Pi and sum it?

I need help for a problem I m having trouble with. I need to create a list with the first 10'000 digits of Pi and sum the digits 259 to 7233. I managed to create a list with the following code: list1 ...
5
votes
1answer
83 views

Extracting binary digits of machine precision numbers

Currently, I am developing an octree data structure. And I need it to be fast. To this end, I would like to have a fast way to extract the $m$ binary digits "after the dot" of each entry in a matrix ...
1
vote
2answers
128 views

How to avoid this type of change of digits in computed numbers?

Is there a way to avoid the digits being changed? ...
2
votes
0answers
58 views

Generating a list of 4-digit integers by simulating four dice being thrown eight times

I simulate throwing four dice and merge their values together to form a 4-digit number. This is done eight times and I want to get a list like this one: ...
1
vote
2answers
97 views

Listing all monotone binary functions

A monotone binary function is defined as follows: Given binary vectors $\bf x$ and $\bf y$ (each having $n$ bits) with $\bf x\geq \bf y$, a function $f:\bf x\rightarrow\{0,1\}$ is called monotone if $...
2
votes
2answers
85 views

Listing all monotone increasing binary digits

For $n=5$, I have $32$ binary digits and for this there are $2^{32}$ combinations. Out of this many, the interesting ones (i.e., the ones that have monotone increasing binary digits) are only about "$...
1
vote
1answer
133 views

How to find the number of digits in a number

IntegerLength[n] will return the number of digits in an integer. I could not find a corresponding function that worked for reals, so I wrote my own function, ...
4
votes
1answer
101 views

Listing numbers with non-repeating digits

I tried to search this but could not find. Given a number of digits(the maximum being 0 to 9), how can I generate a list of all possible numbers without repeating the digits in each number? e.g. Given ...
7
votes
3answers
440 views

How to write an array of repeated numbers as a single number

Let's say we have a random number consisting of an arbitrary number of digits, such as for example 3097. This number can be represented as an array of repeated numbers with Mathematica by typing <...
1
vote
1answer
115 views

Calculate 40 digits of the MRB constant

MRB constant is the upper limit point of the following sequence $$s_n=\sum_{k=1}^{n} (-1)^k k^{\frac{1}{k}}$$ $MRB=\color{blue}{0.1878596}...$ I tried to calculate first few digits: ...
1
vote
2answers
79 views

forward or backward IntegerDigits in pairs must yield different results

I have some pair configurations same as {0,1,1,1,0,1} with {1,0,1,1,0,1} or {1,1,0,1,0,1,1,1}...
0
votes
0answers
39 views

Unpredictable behavior of numerical error

A comparison of float calculation and exact expression for NumberForm[0.3^2 - (3/10)^2, 18] gives an exact zero for $0.3$. However, ...
2
votes
3answers
84 views

Values of sequenced IntegerDigits lists with two fixed elements

How can we access to all values of an IntegerDigits list with a special condition. This restriction is the locality of 0 or <...
8
votes
3answers
150 views

Integer to Alpha Representation [duplicate]

I wanted a nice way to convert natural numbers to alphabetic representations like: ...
5
votes
4answers
402 views

How do I get this recurrent sequence to show?

What exactly am I doing wrong? The dsf function takes the digits of n, raises them to their own power, then adds them together. Here is my dsf function. ...
9
votes
1answer
272 views

Calculate $140$ digits of Conway's Constant from the Look and Say Sequence

The look-and-say sequence is the sequence of numbers $1, 11, 21, 1211, 111221, 312211, …,$ in which each term is constructed by “reading” the previous term in the sequence. For example, the term $1$ ...
6
votes
1answer
202 views

Convert real number to IBM 32 Float (not IEEE)

How can I convert real number to IBM 32 Float? I think how to do it with RealDigits[], IntegerDigits[] and ...
1
vote
2answers
72 views

How can I Influence the number of digits when printing a polynomial expression or when I want to make it a String?

I have an expession (it is the result of Fit) but I want to print or display an abbreviated form with all numbers in it rounded to say 6 decimal digits. ...
1
vote
1answer
53 views

Convert numerical solution to RealDigits

It can be determined that Solve[Gamma[x] == 2*Sqrt[Pi], x] yields a solution of x as ...
4
votes
1answer
118 views

Sum of squared digits returns incorrect result

For the sake of practicing writing code, I've given myself an exercise in writing a script that checks whether a given positive integer is happy, i.e. take the digits of a number, square them, and add ...
0
votes
0answers
30 views

N[variable,2] displays 6 digits [duplicate]

The following code doesn't behave as I expect. Rather than getting 2 digits upon varying r, I get the default value of 6 digits. What's up? ...