Kitonum

21675 Reputation

26 Badges

17 years, 185 days

MaplePrimes Activity


These are replies submitted by Kitonum

It's interesting, why my simple version takes less time than your multithreaded version?

t:=time(): PP({i $ i=1..20}): time()-t;

t:=time(): PowerSet({i $ i=1..20}): time()-t;


                        10.640

                        14.766

It's interesting, why my simple version takes less time than your multithreaded version?

t:=time(): PP({i $ i=1..20}): time()-t;

t:=time(): PowerSet({i $ i=1..20}): time()-t;


                        10.640

                        14.766

@Carl Love

Regarding this example, you are right. But brute force method is more universal. Try to solve by  fsolve  the same question, for example,  for a series  

sum(ln(n)/n^2, n = 1 .. infinity);

@Carl Love

Regarding this example, you are right. But brute force method is more universal. Try to solve by  fsolve  the same question, for example,  for a series  

sum(ln(n)/n^2, n = 1 .. infinity);

If in the code of the procedure to replace the line  

L:=indets(A); m:=nops(L);  

by two lines

L0:=indets(A);
L:=remove(x->is(type(x,`^`)), L0);  m:=nops(L);

then operation of raising to a power is also supported. 

Note: the encoded numbers should not contain protected constants. For example, should be written  pi  rather than  PI or  Pi .

Attached file corrected.

 

Classic example (Knuth Volume 4 Fascicle 2):

Ksolve(pi * R ^ 2 = AREA);

          96*7^2 = 4704

 

Another example:

Ksolve(a^a=bcda);                                

             5^5  = 3125

 

 

Kryptarithms.mws

Acer, thank you very much!

Acer, thank you very much!

@Carl Love 

The following code finds the same solutions as your code, but it works 17 times faster. In fact, it does not matter, because in any of these solutions, excepted one solution,  the condition, that the distinct letters represent distinct digits, does not hold.

restart;

t:=time():

[seq(seq(seq([CNRP=9*10^3+N*10^2+R*10+P, CPP=9*10^2+P*10+P, KHMER=9*10^3+N*10^2+R*10+P+9*10^2+P*10+P], N=0..9), R=0..8, 2), P=0..9)]:

L:=select(n->is(convert(rhs(n[3]),base,10)[1]=convert(rhs(n[1]),base,10)[2] and nops(convert(rhs(n[3]),base,10))=5), %):

time()-t;

nops(L);

                                   0.031 

                                     94

@Carl Love 

The following code finds the same solutions as your code, but it works 17 times faster. In fact, it does not matter, because in any of these solutions, excepted one solution,  the condition, that the distinct letters represent distinct digits, does not hold.

restart;

t:=time():

[seq(seq(seq([CNRP=9*10^3+N*10^2+R*10+P, CPP=9*10^2+P*10+P, KHMER=9*10^3+N*10^2+R*10+P+9*10^2+P*10+P], N=0..9), R=0..8, 2), P=0..9)]:

L:=select(n->is(convert(rhs(n[3]),base,10)[1]=convert(rhs(n[1]),base,10)[2] and nops(convert(rhs(n[3]),base,10))=5), %):

time()-t;

nops(L);

                                   0.031 

                                     94

Different letters denote different figures.  DirectSearch  package ignores the condition  nops({C, E, H, K, M, N, P, R}) = 8

Different letters denote different figures.  DirectSearch  package ignores the condition  nops({C, E, H, K, M, N, P, R}) = 8

@Carl Love 

Of course, calculated solutions are the all solutions. I meant that the code itself can be different. 

@Carl Love 

Of course, calculated solutions are the all solutions. I meant that the code itself can be different. 

@Carl Love 

You wrote "The step length AD must be a multiple of primorial(n) where n is the progression length".  This is not true.

The example:   7, 157, 307, 457, 607, 757, 907

@Carl Love 

You wrote "The step length AD must be a multiple of primorial(n) where n is the progression length".  This is not true.

The example:   7, 157, 307, 457, 607, 757, 907

First 116 117 118 119 120 121 122 Last Page 118 of 133