Sorry - pressed send instead of paste!
Trying again:
=====================================================================
Hello Skip
Points:
0: is this the same Quora which keeps sending me e-messages with headers such as
"What are the best things for Oxford students to do on weekends?"
"What is the best and most prestigious English university nowadays? Oxford? Cambridge?"
- both received yesterday/today!?

1: A reply has just popped up from a sender which I can only see as "Programming Forum", probably not from Jon Hough,  but replying to his comment. It deals in the combinatorial approach which has to be used for larger such problems. It would be nice to know who.

2: Here's a smaller brute force approach.  Consider valid numbers as sextuplets of digits drawn from 0 1 2,  possibly followed by adding 1 to each digit.  We don't need to worry at
all about 3 to 9 to start with.

So, (working on digits 0 1 2):
   100 200 300 400 { sext =: 3#.inv i.3^6   NB. show a few members of the set
0 1 0 2 0 1
0 2 1 1 0 2
1 0 2 0 1 0
1 1 2 2 1 1

   +/(3>>./@:((1, 2~:/\])#;.1 ]))"1 sext   NB. using cut
492

NB. using first differences of indices of change points
   +/(3 > >./@(+/\inv) @ (_1,5,~I.@(2~:/\])))"1 sext
492

   ts' +/(3 > >./@(+/\inv) @ (_1,5,~I.@(2~:/\])))"1 sext'
0.00453397 8640
   ts'+/(3>>./@:((1, 2~:/\])#;.1 ]))"1 sext'
0.00129372 6208

Cheers,

Mike





On 09/04/2018 06:51, Skip Cave wrote:
Here's a fun math challenge on Quora:

Find the number of 6-digit numbers made up of the digits 1, 2, and 3 which
have no digit recurring three or more times, consecutively?

The link to my answer on Quora is: https://goo.gl/BzBDQe

Skip Cave
Cave Consulting LLC
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to