2

I create a list of primes in table form... How do I generate and display the difference between the prime numbers in sequence?

In[1]:= Table[Prime[n], {n, 10}]
Out[1]= {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}

expected output:

{1, 2, 2, 4, 2, 4, 2, 4, 6}

All help gratefully received.

Technophobe01
  • 215
  • 1
  • 6

1 Answers1

3

Here is the one way to do it.

Differences@Prime[Range@10]
OkkesDulgerci
  • 10,716
  • 1
  • 19
  • 38