1

Mathematica novice here.

I want to start with a list of integers that are the product of three distinct primes m,n, and o, where 2 <= m|n|o < 2000.

Sort[Times @@@ Subsets[Select[Range[2000], PrimeQ], {3}]]

How do I find the longest subsequence within this list that consists of consecutive integers?

pgblu
  • 249
  • 1
  • 9
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the [faq]! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Nov 06 '14 at 19:30
  • Thanks - I should have included the follow up in the original question. How can I make it better at this point? – pgblu Nov 06 '14 at 19:31
  • Your current question looks bad. The title refers to "consecutive integers" and the body to "consecutive primes". Please take your time to think your questions so you don't waste other peoples'. – Dr. belisarius Nov 06 '14 at 19:47
  • Duly edited. Thank you. – pgblu Nov 06 '14 at 19:50

1 Answers1

3
Select[Split[Sort[Times @@@ Subsets[Prime@Range@PrimePi@100, {3}]], #2 == #1 + 1 &], 
      Length@# >= 3 &]

( {{1885, 1886, 1887}, {2013, 2014, 2015}} *)
pgblu
  • 249
  • 1
  • 9
Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
  • Aha, I THOUGHT there was something special about the year we live in! ;-) – pgblu Nov 06 '14 at 19:43
  • I recommend looking at those numbers which satisfy PrimeNu[#]==PrimeOmega[#]==3&. – Artes Nov 06 '14 at 19:57
  • @Artes I don't get you. The OP wants to generate numbers in the range {8, ... ,1999^3}. Obviously you're not proposing to check that range, so I don't understand how you would apply your comment. – Dr. belisarius Nov 06 '14 at 23:58