Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2016-10-13 03:43:33

Edossa
Member
Registered: 2016-10-13
Posts: 2

Permutation slot generator

A password has four letters. The first is A,G, P or W, the second is F or P, the third is B, T or Z and the fourth is E, M, Q or R. List all possible passwords.

Is there a program I can use that can generate all possible passwords?

So some examples are...

AFBE
AFBM
AFBQ
AFBR
AFTE
AFTM
AFTQ
AFTR
AFZE
AFZM
AFZQ
AFZR
APBE
etc but it takes forever to do it manually. hmm Thanks!

Last edited by Edossa (2016-10-13 06:42:06)

Offline

#2 2016-10-13 04:58:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

A password has five letters. The first is A,G, P or W, the second is F or P, the third is B, T or Z and the fourth is E, M, Q or R. List all possible passwords.

You only gave choices for the first 4 letters. What can the fifth letter be?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2016-10-13 05:30:31

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Permutation slot generator

If you want it in excel sheet
write A in cells A1 to A24,G in A25 to A48 ,P from A49 to A72 and W from A73 to A96
write F from B1 to B12 , P from B13 to B24. Copy the cells B1 to B24 into B25 to B96.
write B from C1 to C4 ,T from C5 to C8 and Z from C9 to C12 Copy C1 to C12 into  C13 to C96.
Write E,M,Q and R in D1,D2,d3 and D4 cells and copy cells  D1 to D4 into D5 to D96.
Now go to E1 and write =A1&B1&C1&D1 and hit enter key. Now copy cell D1 into D2 to D96 cells.
You have the complete list.

Last edited by thickhead (2016-10-13 22:44:38)


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#4 2016-10-13 06:27:45

Edossa
Member
Registered: 2016-10-13
Posts: 2

Re: Permutation slot generator

bobbym wrote:

A password has five letters. The first is A,G, P or W, the second is F or P, the third is B, T or Z and the fourth is E, M, Q or R. List all possible passwords.

You only gave choices for the first 4 letters. What can the fifth letter be?

That's a mistake, it's meant to read "A password has four letters"

Offline

#5 2016-10-13 06:31:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

There are 4 x 2 x 3 x 4 = 96 possibilities.


{{a, f, b, e}},
{{a, f, b, m}},
{{a, f, b, q}},
{{a, f, b, r}},
{{a, f, t, e}},
{{a, f, t, m}},
{{a, f, t, q}},
{{a, f, t, r}},
{{a, f, z, e}},
{{a, f, z, m}},
{{a, f, z, q}},
{{a, f, z, r}},
{{a, p, b, e}},
{{a, p, b, m}},
{{a, p, b, q}},
{{a, p, b, r}},
{{a, p, t, e}},
{{a, p, t, m}},
{{a, p, t, q}},
{{a, p, t, r}},
{{a, p, z, e}},
{{a, p, z, m}},
{{a, p, z, q}},
{{a, p, z, r}},
{{g, f, b, e}},
{{g, f, b, m}},
{{g, f, b, q}},
{{g, f, b, r}},
{{g, f, t, e}},
{{g, f, t, m}},
{{g, f, t, q}},
{{g, f, t, r}},
{{g, f, z, e}},
{{g, f, z, m}},
{{g, f, z, q}},
{{g, f, z, r}},
{{g, p, b, e}},
{{g, p, b, m}},
{{g, p, b, q}},
{{g, p, b, r}},
{{g, p, t, e}},
{{g, p, t, m}},
{{g, p, t, q}},
{{g, p, t, r}},
{{g, p, z, e}},
{{g, p, z, m}},
{{g, p, z, q}},
{{g, p, z, r}},
{{p, f, b, e}},
{{p, f, b, m}},
{{p, f, b, q}},
{{p, f, b, r}},
{{p, f, t, e}},
{{p, f, t, m}},
{{p, f, t, q}},
{{p, f, t, r}},
{{p, f, z, e}},
{{p, f, z, m}},
{{p, f, z, q}},
{{p, f, z, r}},
{{p, p, b, e}},
{{p, p, b, m}},
{{p, p, b, q}},
{{p, p, b, r}},
{{p, p, t, e}},
{{p, p, t, m}},
{{p, p, t, q}},
{{p, p, t, r}},
{{p, p, z, e}},
{{p, p, z, m}},
{{p, p, z, q}},
{{p, p, z, r}},
{{w, f, b, e}},
{{w, f, b, m}},
{{w, f, b, q}},
{{w, f, b, r}},
{{w, f, t, e}},
{{w, f, t, m}},
{{w, f, t, q}},
{{w, f, t, r}},
{{w, f, z, e}},
{{w, f, z, m}},
{{w, f, z, q}},
{{w, f, z, r}},
{{w, p, b, e}},
{{w, p, b, m}},
{{w, p, b, q}},
{{w, p, b, r}},
{{w, p, t, e}},
{{w, p, t, m}},
{{w, p, t, q}},
{{w, p, t, r}},
{{w, p, z, e}},
{{w, p, z, m}},
{{w, p, z, q}},
{{w, p, z, r}}


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#6 2016-10-13 18:43:40

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi Edossa;

Here's a program in BASIC that generates all possible answers...which are the same as those already posted.

The code is in LibertyBASIC, and can be run online here. Click on the 'Write Your Own' tab if the editor page doesn't open.

a$="AGPW":f$="FP":b$="BTZ":e$="EMQR"
For a=1 To 4
    For f=1 To 2
        For b=1 To 3
            For e=1 To 4
                Print Mid$(a$,a,1);Mid$(f$,f,1);Mid$(b$,b,1);Mid$(e$,e,1)
            Next e
        Next b
    Next f
Next a

Last edited by phrontister (2016-10-21 13:57:48)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#7 2016-10-13 20:07:19

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi thickhead;

Looks like you left out the opening instruction about writing {B,T,Z} into Column C.

Works fine, otherwise.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#8 2016-10-13 22:39:52

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Permutation slot generator

Extract from excel sheet.

                         Formula                  result
A	F	B	E	=+A1&B1&C1&D1	AFBE
A	F	B	M	=+A2&B2&C2&D2	AFBM
A	F	B	Q	=+A3&B3&C3&D3	AFBQ
A	F	B	R	=+A4&B4&C4&D4	AFBR
A	F	T	E	=+A5&B5&C5&D5	AFTE
A	F	T	M	=+A6&B6&C6&D6	AFTM
A	F	T	Q	=+A7&B7&C7&D7	AFTQ
A	F	T	R	=+A8&B8&C8&D8	AFTR
A	F	Z	E	=+A9&B9&C9&D9	AFZE
A	F	Z	M	=+A10&B10&C10&D10	AFZM
A	F	Z	Q	=+A11&B11&C11&D11	AFZQ
A	F	Z	R	=+A12&B12&C12&D12	AFZR
A	P	B	E	=+A13&B13&C13&D13	APBE
A	P	B	M	=+A14&B14&C14&D14	APBM
A	P	B	Q	=+A15&B15&C15&D15	APBQ
A	P	B	R	=+A16&B16&C16&D16	APBR
A	P	T	E	=+A17&B17&C17&D17	APTE
A	P	T	M	=+A18&B18&C18&D18	APTM
A	P	T	Q	=+A19&B19&C19&D19	APTQ
A	P	T	R	=+A20&B20&C20&D20	APTR
A	P	Z	E	=+A21&B21&C21&D21	APZE
A	P	Z	M	=+A22&B22&C22&D22	APZM
A	P	Z	Q	=+A23&B23&C23&D23	APZQ
A	P	Z	R	=+A24&B24&C24&D24	APZR
G	F	B	E	=+A25&B25&C25&D25	GFBE
G	F	B	M	=+A26&B26&C26&D26	GFBM
G	F	B	Q	=+A27&B27&C27&D27	GFBQ
G	F	B	R	=+A28&B28&C28&D28	GFBR
G	F	T	E	=+A29&B29&C29&D29	GFTE
G	F	T	M	=+A30&B30&C30&D30	GFTM
G	F	T	Q	=+A31&B31&C31&D31	GFTQ
G	F	T	R	=+A32&B32&C32&D32	GFTR
G	F	Z	E	=+A33&B33&C33&D33	GFZE
G	F	Z	M	=+A34&B34&C34&D34	GFZM
G	F	Z	Q	=+A35&B35&C35&D35	GFZQ
G	F	Z	R	=+A36&B36&C36&D36	GFZR
G	P	B	E	=+A37&B37&C37&D37	GPBE
G	P	B	M	=+A38&B38&C38&D38	GPBM
G	P	B	Q	=+A39&B39&C39&D39	GPBQ
G	P	B	R	=+A40&B40&C40&D40	GPBR
G	P	T	E	=+A41&B41&C41&D41	GPTE
G	P	T	M	=+A42&B42&C42&D42	GPTM
G	P	T	Q	=+A43&B43&C43&D43	GPTQ
G	P	T	R	=+A44&B44&C44&D44	GPTR
G	P	Z	E	=+A45&B45&C45&D45	GPZE
G	P	Z	M	=+A46&B46&C46&D46	GPZM
G	P	Z	Q	=+A47&B47&C47&D47	GPZQ
G	P	Z	R	=+A48&B48&C48&D48	GPZR
P	F	B	E	=+A49&B49&C49&D49	PFBE
P	F	B	M	=+A50&B50&C50&D50	PFBM
P	F	B	Q	=+A51&B51&C51&D51	PFBQ
P	F	B	R	=+A52&B52&C52&D52	PFBR
P	F	T	E	=+A53&B53&C53&D53	PFTE
P	F	T	M	=+A54&B54&C54&D54	PFTM
P	F	T	Q	=+A55&B55&C55&D55	PFTQ
P	F	T	R	=+A56&B56&C56&D56	PFTR
P	F	Z	E	=+A57&B57&C57&D57	PFZE
P	F	Z	M	=+A58&B58&C58&D58	PFZM
P	F	Z	Q	=+A59&B59&C59&D59	PFZQ
P	F	Z	R	=+A60&B60&C60&D60	PFZR
P	P	B	E	=+A61&B61&C61&D61	PPBE
P	P	B	M	=+A62&B62&C62&D62	PPBM
P	P	B	Q	=+A63&B63&C63&D63	PPBQ
P	P	B	R	=+A64&B64&C64&D64	PPBR
P	P	T	E	=+A65&B65&C65&D65	PPTE
P	P	T	M	=+A66&B66&C66&D66	PPTM
P	P	T	Q	=+A67&B67&C67&D67	PPTQ
P	P	T	R	=+A68&B68&C68&D68	PPTR
P	P	Z	E	=+A69&B69&C69&D69	PPZE
P	P	Z	M	=+A70&B70&C70&D70	PPZM
P	P	Z	Q	=+A71&B71&C71&D71	PPZQ
P	P	Z	R	=+A72&B72&C72&D72	PPZR
W	F	B	E	=+A73&B73&C73&D73	WFBE
W	F	B	M	=+A74&B74&C74&D74	WFBM
W	F	B	Q	=+A75&B75&C75&D75	WFBQ
W	F	B	R	=+A76&B76&C76&D76	WFBR
W	F	T	E	=+A77&B77&C77&D77	WFTE
W	F	T	M	=+A78&B78&C78&D78	WFTM
W	F	T	Q	=+A79&B79&C79&D79	WFTQ
W	F	T	R	=+A80&B80&C80&D80	WFTR
W	F	Z	E	=+A81&B81&C81&D81	WFZE
W	F	Z	M	=+A82&B82&C82&D82	WFZM
W	F	Z	Q	=+A83&B83&C83&D83	WFZQ
W	F	Z	R	=+A84&B84&C84&D84	WFZR
W	P	B	E	=+A85&B85&C85&D85	WPBE
W	P	B	M	=+A86&B86&C86&D86	WPBM
W	P	B	Q	=+A87&B87&C87&D87	WPBQ
W	P	B	R	=+A88&B88&C88&D88	WPBR
W	P	T	E	=+A89&B89&C89&D89	WPTE
W	P	T	M	=+A90&B90&C90&D90	WPTM
W	P	T	Q	=+A91&B91&C91&D91	WPTQ
W	P	T	R	=+A92&B92&C92&D92	WPTR
W	P	Z	E	=+A93&B93&C93&D93	WPZE
W	P	Z	M	=+A94&B94&C94&D94	WPZM
W	P	Z	Q	=+A95&B95&C95&D95	WPZQ
W	P	Z	R	=+A96&B96&C96&D96	WPZR

{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#9 2016-10-14 00:48:18

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi thickhead;

Yes, that's how I did it too, but without the plus sign in column E (not needed).


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#10 2016-10-14 02:24:13

thickhead
Member
Registered: 2016-04-16
Posts: 1,086

Re: Permutation slot generator

It has come unintentionally. I spotted it just now.


{1}Vasudhaiva Kutumakam.{The whole Universe is a family.}
(2)Yatra naaryasthu poojyanthe Ramanthe tatra Devataha
{Gods rejoice at those places where ladies are respected.}

Offline

#11 2016-10-16 11:05:18

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi Bobby;

I tried to code it in M, but only succeeded with the BASIC approach like in my post #6 (but with slightly shorter code):

aa={A,G,P,W};
ff={F,P};
bb={B,T,Z};
ee={E,M,Q,R};
For[a=1,a<5,a++,For[f=1,f<3,f++,For[b=1,b<4,b++,For[e=1,e<5,e++,
Print[aa[[a]],ff[[f]],bb[[b]],ee[[e]]]]]]]

Anyway, something new I learned was that uppercase E (in variable ee) is reserved for exponential constant e.

At first I thought I'd have to change the letter, but then discovered that although M's output prints E as e, when the output is copied as plain text and pasted here (and in other software), e prints as E.

Last edited by phrontister (2016-10-16 11:11:15)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#12 2016-10-16 16:02:19

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

Flatten[Outer[List, {a, g, p, w}, {f, p}, {b, t, z}, {e, m, q, r}], 3] // ColumnForm

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#13 2016-10-16 16:39:55

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Ah, yes...that's the one I missed. up

I'd been looking in the Tuples, Permutations and Subsets general area, but overlooked Outer for some reason, even though it appears as a 'See Also' under Tuples.

Last edited by phrontister (2016-10-16 16:41:24)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#14 2016-10-16 21:58:24

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

M has the weird property that invoking a built in command is often not the best. This is the first language I have ever seen like that. For instance,

http://mathematica.stackexchange.com/qu … f-a-number

I used FindInstance which is the built-in command. The two guys that answered did not. Mine gags on a large example, theirs do not.

This is part of my problem, I am stylistically trained to seek out the proper built-in command. The one that exactly does what the problem wants. I find it and implement it. I end up with code that is slow and sometimes even fails.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#15 2016-10-17 12:51:45

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Interesting...what I understand of it! dizzy

Anyway, here are some things I've noticed:

1. A correctness check is needed, as george2079 said.
   eg, 12398 and 123476 have no solution, treated this way by the 3 codes:
    - george2079's code gives "the 'closest' value", and, helpfully, his check announces "False";
    - J. M.'s code just gives the 'closest' (I suppose) value - like george2079 - with no correctness announcement;
    - Your code gives strange-looking answers...which probably indicates that they don't have a solution.

2. george2079's code has an error that prevents me from running his program (one of the closing brackets after Divide @@ # has to go), and should be:

m = 308460277;
Reap[NestWhile[{#[[1]] - #[[2]] Sow@Floor[Divide @@ #], 
      Floor[#[[2]]/10]} &, {m, 
     FromDigits@ConstantArray[1, Ceiling@Log[10, m]]} , #[[2]] > 
      0 &]][[2, 1]] // FromDigits

3. george2079's check could be improved by replacing the answer input with "%", like so (his way would have been for clarity's sake, I guess):

Total@NestWhileList[ Floor[#/10] &, %, # > 0 &]==m

4. Your code fails on some valid inputs (answers found by the other two guys' codes): eg, 12333, 12344, 12355, 12366, 12377, 12388, 12399.
    They might be the only fails, but I didn't check right up to infinity. wink

5. A little tweak for your code (which I know you already know! smile )

First line: m = 308460277; n = IntegerLength[m];

I wonder what percentage of numbers fail, and their composition? But I don't really need to know...

Last edited by phrontister (2016-10-18 01:45:00)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#16 2016-10-17 22:31:05

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

Hi;

I will look at that and nope, I did not even know about the command IntegerLength!

The first time I tried george's answer it worked fine. He must have edited it later on and left out a bracket.

In the end I had to accept J.M.'s code because it was the fastest. Again, during that time george's code was running fine.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#17 2016-10-18 02:08:08

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi Bobby;

He must have edited it later on and left out a bracket.

He had one bracket too many.

In the end I had to accept J.M.'s code because it was the fastest.

Theirs were both instantaneous on a 50-digit number.

Mine gags on a large example, theirs do not.

Yours got the right answer on that same 50-digit number (in 0.14 seconds), so it wasn't the length of the input number that was the problem.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#18 2016-10-18 03:33:39

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

Hi;

I used AbsoluteTiming and on all three, J.M.'s was a bit faster.

Do you mean this m = 137174210013717421001371742085? Mine could not answer it.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#19 2016-10-18 09:57:09

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

I don't know what the number was, as I used RandomInteger[10^50] to generate it and didn't save it.

This is my changed version of your code that I used. It includes George's check.

m=RandomInteger[10^50]
n=IntegerLength[m];
var=Table[Subscript[a,k],{k,n,1,-1}];
f=Sum[1/9 (-1+10^k) Subscript[a,k],{k,1,n}]==m;
s=FindInstance[Append[{f,10>Subscript[a,1]>0},Table[10>Subscript[a,k]>=0,{k,2,n}]]//Flatten,var,Integers];
FromDigits[Flatten[var/.s]]
Total@NestWhileList[Floor[#/10]&,%,#>0&]==m

I think you'll find most numbers will work: eg, 69586679352243945460884074620809492862023430738549. That works in JM's & George's too, and comes up as "True" in George's check.

38994141682523903136734583674252327906171348631335 has a solution, but your code complains. Try it! smile


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#20 2016-10-18 10:59:19

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

Hi;

Mine spits out the variables a1 to a50, this means that for some reason FindInstance fails.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#21 2016-10-18 11:29:35

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

That's what it also does with the two numbers I mentioned in post #15 (12398 and 123476). Those two don't have a solution, but the 50-digit one does.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#22 2016-10-18 18:52:05

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

Hi;

When M does not find anything it tends to just give back the problem. That is what I entered or rather my program enters into FindInstance, so that is what it will return when it finds no solution. In the first two cases (12398 and 123476) it is correct to do so although a bit ugly. In the 50 digit problem I think FindInstance can not find the solution although he can do larger ones. That is why neither of those two other guys used FindInstance. I use built-ins as much as I can. I come from a different era and philosophy and when it comes to M, I am obsolete.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#23 2016-10-19 01:03:54

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi Bobby;

'Obsolete'?? I take it the meaning is in the teenage-speak word-inversion sense.

As wicked = good/great, and sick = cool/awesome, so obsolete = now/happening/up-to-the-minute. eg, someone referred to as being 'obsolete' is really a now (as in right now)/up-to-date person, with his finger right on the pulse. And no, he's not checking his pulse to see if it's still ticking!

Just to confirm that it's not the number size that's the problem with your code, I gave it this 1000-digit number to solve:

I don't know how long it took because I forgot to include the timer in the code, but it started looking for the answer late this afternoon, was still busy at it 3 hours or so later when I had to go out, but when I got home 2-and-a-half hours later it was waiting for me with the answer:

JM found the same solution as yours in 0.004 seconds, and George found it in 0.020 seconds.

George's check says "True" in each case, but I haven't checked it myself. I'm happy to accept George's code's say-so! smile

Last edited by phrontister (2016-10-19 11:31:13)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#24 2016-10-19 04:18:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Permutation slot generator

Hi;

So, mine took 3 hours+ and his took .02 seconds....

Seems like the diamond effect has taken place in my own lifetime.

And no, he's not checking his pulse to see if it's still ticking!

Something of a paradox, if while checking you do not find a pulse, you are dead and therefore how could you be checking?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#25 2016-10-19 10:09:56

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,810

Re: Permutation slot generator

Hi Bobby;

If he's checking his pulse to see if it's still ticking, something else isn't ticking as it should!

So, mine took 3 hours+ and his took .02 seconds....

George's time was 5 times that of JM's.

I ran yours again overnight on the same number, and solving time was just over 6 hours. Just to put the 'just' part into perspective when compared to JM's time, just that part alone (ie, without the 6 hours part) is just over 5732.31012092 times the speed of JM's. So now you know how many seconds yours took - within a smidgen.

I give JM's comment - "A ploddingly procedural implementation" - a like. smile

What is 'the diamond effect'?

Last edited by phrontister (2016-10-19 10:58:49)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

Board footer

Powered by FluxBB