9 votes

Make a list of the first 100 primes, keeping only ones whose last digit is less than 3

SolveValues[x <= Prime[100] && Mod[x, 10] < 3, x, Primes] ...
kglr's user avatar
  • 395k
8 votes
Accepted

Make a list of the first 100 primes, keeping only ones whose last digit is less than 3

Well, since the cat's out of the bag, I guess we can proceed with our race-toward-ten. I'll provide a point-free solution to the original problem and avoid the OP's question about the specific ...
lericr's user avatar
  • 28k
6 votes

Solving a-two-variable equation in primes

FindInstance cannot prove that there are no solutions, especially when the domain of solutions is the set of primes. More acceptable approach would be: ...
Artes's user avatar
  • 57.3k
6 votes

Make a list of the first 100 primes, keeping only ones whose last digit is less than 3

Expanding on my comment (first method) 1. Select[Prime[Range[100]], Mod[#, 10] < 3 &] here are two more (kind of cheating because 2 is an exception) 2. <...
ydd's user avatar
  • 3,693
6 votes

Incrementing Numbers

From the question we can easily deduce the sequence s = {3, 5, 9, 15}; With FindSequenceFunction we get ...
eldo's user avatar
  • 69.5k
5 votes

Make a list of the first 100 primes, keeping only ones whose last digit is less than 3

Another option using what the question asks, which is to use f[#] p = Prime[Range[100]] ...
Nasser's user avatar
  • 143k
4 votes
Accepted

Solving a-two-variable equation in primes

Indeed, this can be done in one line: FindInstance[x^3 - y^4 == 1, {x, y}, Primes] {} No solution in the primes.
user64494's user avatar
  • 26.3k
4 votes

Make a list of the first 100 primes, keeping only ones whose last digit is less than 3

Just to illustrate Sow and Reap ...
ubpdqn's user avatar
  • 60.7k
3 votes

Prime $p$ that results in a power of 2

Another implementation using NestWhile: f[p_]:=NestWhile[2 # &, 2^Ceiling[Log[2, p]], !PrimeQ[# - p] &] - p; f[857] f[859] (*167*) (*7333*) Some primes ...
ydd's user avatar
  • 3,693
3 votes

Incrementing Numbers

l = Range[9]; Using Table and Take: ...
E. Chan-López's user avatar
3 votes

How to combine a list of the prime factors?

Table[#1, #2] & @@@ lis // Map[Apply[Sequence]] // Apply[Times] or Times @@ (Sequence @@ Table[#1, #2] & @@@ lis) or <...
Syed's user avatar
  • 53.6k
3 votes

Incrementing Numbers

Also (from https://oeis.org/A027688): Table[Fibonacci[3, n] + n + 2, {n, 0, 9}] {3, 5, 9, 15, 23, 33, 45, 59, 75, 93}
vindobona's user avatar
  • 3,391
2 votes

Incrementing Numbers

(Edited) Perhaps the OP requires something like the following? ...
user1066's user avatar
  • 18.2k
2 votes

Listing products of prime powers

Using Inner: n = 39510856; Inner[Superscript, Sequence @@ Transpose@FactorInteger[n], CenterDot]
Syed's user avatar
  • 53.6k
2 votes

Make a list of the first 100 primes, keeping only ones whose last digit is less than 3

As all valid primes other than 2 must end in 1: ...
user1066's user avatar
  • 18.2k
2 votes

Binary Distance between the two Primes

Are you looking for something like Grid[Table[p = Prime[n]; {p, dyb[p], p + 2^dyb[p]}, {n, 1, 10}], Frame -> All]? EDIT: I think this fixes your function: ...
Gragarian's user avatar
2 votes

Prime $p$ that results in a power of 2

Why not NestWhile f[n_] := NestWhile[NextPrime, 0, !IntegerQ[Log2[ # + n]]& ]; f[859] 7333
AsukaMinato's user avatar
  • 9,808
1 vote

Binary Distance between the two Primes

...
Rubens Vilhena Fonseca's user avatar
1 vote

Prime $p$ that results in a power of 2

It's hard to pinpoint exactly what is wrong because there are several weird things about your code and how you use variables. Anyhow, keeping the same algorithmic approach, one could use ...
Domen's user avatar
  • 24.7k
1 vote

How to combine a list of the prime factors?

list = {{2, 1}, {3, 2}, {43, 5}, {26684839, 1}}; Two slot-free variants of Syed's solution: Using Splice (new in 12.1) ...
eldo's user avatar
  • 69.5k
1 vote

Prime-palindromic number selected from a list

Just rephrasing the accepted answer with the help of a function: ...
Syed's user avatar
  • 53.6k

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