Skip to main content
17 votes

How can I program the last digits of Fibonacci numbers?

This can be computed almost instantaneously due to one curious property of the Fibonacci numbers: Their sequence is periodic modulo any modulus $m$. These periods are known as Pisano periods $\pi(m)$. ...
yarchik's user avatar
  • 19.2k
13 votes

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

I call this ambiguous and I think you haven't thought this through. Let us assume it would be possible by such a direct method of calculating $\lambda$. First, we need to speed up the high-level ...
halirutan's user avatar
  • 113k
11 votes

How can I program the last digits of Fibonacci numbers?

Using an undocumented function (see this as well) to implement the matrix form of the Fibonacci recurrence (see this as well): ...
J. M.'s missing motivation's user avatar
10 votes

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

That can easily be done by separating each number into digits and re-assembling them as Number {3097, 3097, 3097, 3097} // IntegerDigits // Flatten // FromDigits
halirutan's user avatar
  • 113k
8 votes
Accepted

Convert real number to IBM 32 Float (not IEEE)

Compiled solution I found this solutions. ...
Kirill Belov's user avatar
8 votes

How can I program the last digits of Fibonacci numbers?

I combined MatrixPowerMod from Bressoud & Wagon's book, A Course in Computational Number Theory, with a Fold formulation from @J.M.'s, to give ...
KennyColnago's user avatar
  • 15.3k
7 votes

How do I get this recurrent sequence to show?

EDITS 29.04.17 - Cycle plot extended to base 20 using a code based on Tally[]. - Extend list of cycle lengths to b = 20 28.04.17 - Results: plots added 27.04.17 - Proof of periodicity 26.04.2017 -...
Dr. Wolfgang Hintze's user avatar
7 votes
Accepted

Integer to Alpha Representation

I think you can use IntegerDigits directly if you add an offset, and then use the 3rd argument of IntegerDigits to only return ...
Carl Woll's user avatar
  • 131k
7 votes

How to find the number of digits in a number

Inte> IntegerLength[n] will return the number of digits in an integer. I could not find a corresponding function that worked for reals It is not very clear what "number of digits" might even mean ...
Szabolcs's user avatar
  • 236k
7 votes

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

Does this do what you want: Total @ RealDigits[Pi, 10, 10^4][[1,259;;7233]]
user5601's user avatar
  • 3,705
7 votes

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

OP's method used with smaller number of digits: ...
kglr's user avatar
  • 399k
7 votes
Accepted

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

Use Mod: f[n_, list_] := Mod[list, 10^n] Then: f[1, A] f[2, A] f[3, A] {1, 2, 3, 1, 6} {...
Carl Woll's user avatar
  • 131k
7 votes
Accepted

DigitCount[], but in negative bases

Background mathworld.wolfram.com contains entries for Negabinary, Negadecimal and Base, including Wolfram language code examples Base $(-2)$ Negabinary ...
rhermans's user avatar
  • 36.9k
6 votes
Accepted

Listing numbers with non-repeating digits

The lists of digits of the numbers you are looking for are mere permutations of the digits $0,\,1,\,2\,\dotsc,9$. Permutations can provide you with these ...
Henrik Schumacher's user avatar
6 votes
Accepted

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

RealDigits[Pi, 10, 10000] // First // Take[#, {259, 7233}] & // Total
Rohit Namjoshi's user avatar
6 votes

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

You can use the four-argument of form of RealDigits: RealDigits[$x, b, len, n$] gives len digits starting with the coefficient of $b^n$. ...
kglr's user avatar
  • 399k
6 votes

About a problem with FromDigits

The documentation mentions (in a bullet point in "Details") FromDigits[{list,n},b] takes n to be an exponent [...] I think ...
thorimur's user avatar
  • 9,020
5 votes

Integer to Alpha Representation

A memoized recursive approach seems faster: ...
MarcoB's user avatar
  • 67.5k
5 votes
Accepted

Sum of squared digits returns incorrect result

The fix: use SetDelayed instead of Set when defining ssd: ...
kglr's user avatar
  • 399k
5 votes

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

To address the question, as was already mentioned in the comments if you want arbitrary precision use exact numbers. In this case, your expression can be written as ...
Hans Olo's user avatar
  • 1,838
5 votes
Accepted

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

20000 in 21 seconds. ...
Jean-Pierre's user avatar
  • 5,222
4 votes

Convert numerical solution to RealDigits

Use N: Solve[Gamma[x] == 2*Sqrt[Pi], x] RealDigits[x /. N@%]
Alan's user avatar
  • 13.8k
4 votes
Accepted

Values of sequenced IntegerDigits lists with two fixed elements

...
Alan's user avatar
  • 13.8k
4 votes

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

Update: A shorter alternative using FromDigits with base 10^commonIntegerLength: ...
kglr's user avatar
  • 399k
4 votes

prime number digits less than n?

1337 has four digits. You ask for primes with 3 digits less than that. Select[Range[10^(Floor[Log10[1337]]-3),10^(Floor[Log10[1337]]-2)],PrimeQ] gives you ...
Bill's user avatar
  • 12.2k
4 votes

DigitCount[], but in negative bases

Here is my solution which uses a loop format mimicking the solutions on Wikipedia ...
IntroductionToProbability's user avatar
3 votes
Accepted

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

The Problem There are two distinct issues at work: Why is the result of the simple arithmetic operation different from what you'd expect? How can we change the display (as opposed to the value) of a ...
Robert Jacobson's user avatar
3 votes

Calculate 40 digits of the MRB constant

First of all take a look at the thread mentioned in the comments for a sequence with faster convergence. Using one of the more obvious series (also mentioned in the MathWorld article you linked), the ...
TimRias's user avatar
  • 3,180
3 votes

Listing all monotone binary functions

Here's an approach using Reduce. The first step is to construct all of the inequalities. Consider a bit vector $b(1, 0, 1, 0)$. The inequalities that can be ...
Carl Woll's user avatar
  • 131k
3 votes

Values of sequenced IntegerDigits lists with two fixed elements

I would use Quotient/Mod: ...
Carl Woll's user avatar
  • 131k

Only top scored, non community-wiki answers of a minimum length are eligible