Questions tagged [digits]

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

Filter by
Sorted by
Tagged with
4 votes
2 answers
178 views

DigitCount[], but in negative bases

The DigitCount[n,b] function "counts the gives a list of the numbers of $1, 2, \ldots, b-1, 0$ digits in the base-$b$ representation of $n$". I want to ...
Klangen's user avatar
  • 967
4 votes
2 answers
94 views

Test if the decimal digits of $n$ appear $n$ times in the decimal representation of $n!$

I want to find numbers $n$ for which the decimal digits of $n$ appear $n$ times in the decimal representation of $n!$. For instance, $n\in\left\{0, 1, 1170, 1528, 9877, 9886, 9897, 11535\right\}$ are ...
Jan Eerland's user avatar
  • 1,941
1 vote
0 answers
65 views

Extracting digits of a real number with RealDigits produces unexpected result

I have a list of real numbers, each of which has two decimal places. I'm trying to extract the second digit after the decimal point. The function I'm using is ...
user45937's user avatar
  • 1,291
1 vote
3 answers
70 views

Digits product and an iteration process

I would like to create a code which gives me the square of the product of the digits of a number, with the only rule that if a number has a 0, then it doesn't count in the product (for example, if the ...
Luca Onnis's user avatar
4 votes
4 answers
74 views

How to create a function that merges the first $n$-digits of each value in a list?

Suppose we have a list of numbers. For example, A={1231,1232,1233,1241,1236} Using a function f[x,A], I want to rearrange this ...
Arbuja's user avatar
  • 39
3 votes
1 answer
297 views

How do I force mathematica to output more digits for this particular expression? [closed]

I'm working on a project where a certain calculation of $\pi$ to an arbitrary precision is required. I'm evaluating the below expression in Mathematica: $6\sum_{k=0}^{\infty}\left(\frac{\left(-0.5\...
hylsis's user avatar
  • 31
0 votes
0 answers
51 views

How do I increase an amount of digits after the point?

I have an expression such as: Log[0.784637, 517.8796]*ArcTan[-1.112673]*0.4256^(-2.034)*Sqrt[3.567] and I get 3 digits precision. I tried: ...
Cpp Nosavvier's user avatar
0 votes
0 answers
100 views

How to copy and paste numbers with "`" mark and use them in calculations, without using N or setting precision every time

Suppose we have run a calculation and get a number like 2.758952615889003` If we then copy-paste this number and do a calculation like ...
user106860's user avatar
11 votes
3 answers
2k views

How can I program the last digits of Fibonacci numbers?

Is there a way to compute the last digits of an arbitrarily large Fibonacci number? For the $10^n$th Fibonacci number, we can just find the $2^n$-th Fibonacci number (if that isn't too large) $\bmod n$...
Allam A.'s user avatar
  • 333
2 votes
1 answer
191 views

Listing numbers whose digit sum is greater or equal 5

I just started using Mathematica and at the moment I'm learning some things. As you can see in the headline, I want to make a list of numbers (up to 100) whose digit sum is greater or equal 5. I ...
Beggi01's user avatar
  • 23
3 votes
1 answer
74 views

About a problem with FromDigits

I have tried FromDigits[{{1, 2, 3, 4},{2,3, 4, 1}, {3, 4, 1, 2}, {4, 1, 2, 3}}] and the result is as expected {1234,2341,3412,4123}. However for ...
Tapioka's user avatar
  • 31
4 votes
1 answer
134 views

Consider all numbers, from two-digit up to 10-digit, written only with digits 1, 2, 3, 5, 7. Identify those that are perfect squares

Consider all numbers, from two-digit up to 10-digit, written only with digits 1, 2, 3, 5, 7. Identify those that are perfect squares I got this problem but don't know how to solve it. This is what I ...
alan delachair's user avatar
4 votes
1 answer
122 views

Correcting nonsense digits during data import

I import large amounts of data, and for whatever reason the data in cases add large numbers of either '0s' or '9s'. However, as the numbers have very different relevant digits, I cannot simply use ...
Mockup Dungeon's user avatar
1 vote
2 answers
125 views

Generate a sequence of primes giving position and value of a digit in its digit-decomposed version

The prime sequence starts: ...
Hans Havermann's user avatar
2 votes
3 answers
123 views

prime number digits less than n? [closed]

How can I ask mathematica to sieve with only primes with three-digit less than a given number. Thank you for instance I want to find the prime factor of 1337. Thank you
french beginner's user avatar
1 vote
1 answer
50 views

Constructing 'instrument error' or flooring a number to the last decimal digit

So I have a really sample task i would love to solve without things getting overly (and unnecessarily) complex. I have a list of imported data coming from some instrument measurements in the form: {...
deppep's user avatar
  • 83
9 votes
3 answers
2k 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 ...
user avatar
6 votes
1 answer
159 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 ...
Henrik Schumacher's user avatar
2 votes
2 answers
157 views

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

Is there a way to avoid the digits being changed? ...
qazwsx's user avatar
  • 8,666
2 votes
0 answers
70 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: ...
beemen's user avatar
  • 193
1 vote
2 answers
225 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 $...
Seyhmus Güngören's user avatar
2 votes
2 answers
141 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 "$...
Seyhmus Güngören's user avatar
1 vote
1 answer
1k 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, ...
hagbard7000's user avatar
4 votes
1 answer
256 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 ...
JHS's user avatar
  • 43
8 votes
3 answers
554 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 <...
George Pa1's user avatar
1 vote
1 answer
161 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: ...
vito's user avatar
  • 8,868
1 vote
2 answers
83 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}...
Inzo Babaria's user avatar
  • 1,503
0 votes
0 answers
44 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, ...
pawel_winzig's user avatar
  • 1,567
2 votes
3 answers
91 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 <...
Inzo Babaria's user avatar
  • 1,503
8 votes
3 answers
194 views

Integer to Alpha Representation [duplicate]

I wanted a nice way to convert natural numbers to alphabetic representations like: ...
b3m2a1's user avatar
  • 46.6k
5 votes
4 answers
471 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. ...
volcanrb's user avatar
  • 373
11 votes
2 answers
760 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$ ...
vito's user avatar
  • 8,868
7 votes
1 answer
293 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 ...
Kirill Belov's user avatar
1 vote
2 answers
127 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. ...
Adalbert Hanßen's user avatar
1 vote
1 answer
61 views

Convert numerical solution to RealDigits

It can be determined that Solve[Gamma[x] == 2*Sqrt[Pi], x] yields a solution of x as ...
Leucippus's user avatar
  • 365
4 votes
1 answer
147 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 ...
user170231's user avatar
  • 1,581
0 votes
0 answers
33 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? ...
Stephen's user avatar
  • 1,156