Skip to main content
19 votes

Digits of Pi in colored spiral

At first we define the Archimedean spiral in parametric form a := 0; b := 0.3; r[t_] := a + b t; x[t_] := r[t]*Cos[t]; y[t_] := r[t]*Sin[t]; Next, generate a list ...
yarchik's user avatar
  • 18.7k
13 votes

Determining occurrence of a sequence of numbers in the first 50,000 primes

out = Select[MatchQ[IntegerDigits[#], {___, 5, ___, 4, ___, 3, ___}] &]@ Prime[Range[50000]]; Length@out 1588 ...
kglr's user avatar
  • 397k
11 votes

Determining occurrence of a sequence of numbers in the first 50,000 primes

Prime and IntegerDigits are Listable, ___ (i.e. ...
Artes's user avatar
  • 57.5k
8 votes

Determining occurrence of a sequence of numbers in the first 50,000 primes

This should be speedier... Pick[p = Prime@Range@5*^4, StringMatchQ[IntegerString[p], "*5*4*3*"]]
ciao's user avatar
  • 25.8k
6 votes

Determining occurrence of a sequence of numbers in the first 50,000 primes

Prime[Range[50000]] // Short IntegerDigits /@ % // Short Flatten[SequenceCases[#, {___, 5, ___, 4, ___, 3, ___}] & /@ %, 1] // Length (* 1588 *) If you want ...
AccidentalFourierTransform's user avatar
6 votes
Accepted

Digits of Pi in colored spiral

p defines how many disks there are in each revolution and do number of revolutions. ...
azerbajdzan's user avatar
  • 18.9k
6 votes

Digits of Pi in colored spiral

Using ArcLength and MapThread: ...
Syed's user avatar
  • 55.5k
4 votes

Digits of Pi in colored spiral

...
Bob Hanlon's user avatar
  • 159k
4 votes

Self-locating Strings in $\pi$?

This should be able to treat leading zeroes and is ten times faster: A precompiled function: ...
Henrik Schumacher's user avatar
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
2 votes
Accepted

Counting the number of Configurations in an Array with Constraints

A brute-force approach: ...
kglr's user avatar
  • 397k
1 vote

Digits of Pi in colored spiral

This is going to require someone with much more Graphics knowledge than me, but we can start by creating a spiral of points and coloring based off digit: ...
ydd's user avatar
  • 3,937
1 vote

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

I'm not fluent in Mathematica (and don't have access to it so I don't know how my code compares to those given here) but I added a link to an efficient PARI/GP program in oeis.org/A333085, which ...
Max's user avatar
  • 111
1 vote

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

I present a re-coded solution involving two functions. I have avoided using AppendTo and procedural constructs where possible. ...
MarcoB's user avatar
  • 67.3k
1 vote

Short Normal Numbers in base 10

I'm not sure this is much of an improvement, but it does yield the same result as the OP. ...
MelaGo's user avatar
  • 8,751
1 vote

Counting the number of Configurations in an Array with Constraints

I think you are looking for the number of binary necklaces of length n with no subsequence 000 (or 111), which is Sloane's A09335. The code given there is the following. ...
KennyColnago's user avatar
  • 15.3k
1 vote
Accepted

Listing all monotone binary functions

...
kglr's user avatar
  • 397k

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