18
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 ...
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
...
11
votes
Determining occurrence of a sequence of numbers in the first 50,000 primes
Prime and IntegerDigits are Listable, ___ (i.e. ...
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*"]]
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 ...
6
votes
Accepted
Digits of Pi in colored spiral
p defines how many disks there are in each revolution and do number of revolutions.
...
6
votes
4
votes
4
votes
Self-locating Strings in $\pi$?
This should be able to treat leading zeroes and is ten times faster:
A precompiled function:
...
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 ...
2
votes
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:
...
2
votes
Accepted
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 ...
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.
...
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.
...
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.
...
1
vote
Accepted
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
digit-sequences × 8list-manipulation × 2
prime-numbers × 2
sequence × 2
digits × 2
graphics × 1
calculus-and-analysis × 1
pattern-matching × 1
color × 1
number-theory × 1
number-representation × 1
integer-sequence × 1
counting × 1
recreational-mathematics × 1