Post Reply 
Short & Sweet Math Challenge #21: Powers that be
11-08-2016, 03:15 PM
Post: #17
RE: Short & Sweet Math Challenge #21: Powers that be
Here are the results of my search on HP71/Emu71:
Order 2
1.61803398875 ok x^2-x-1
Order 3
1.83928675521 ok x^3-x^2-x-1
1.46557123188 ok x^3-x^2-1
1.32471795724 ok x^3-x-1
Order 4
1.92756197548 ok x^4-x^3-x^2-x-1
1.75487766625 ok x^4-x^3-x^2-1
1.61803398875 ok x^4-x^3-x-1
1.46557123188 ok x^4-x^2-x-1
Order 5
1.61803398875 ok x^5-x^4-x^3+x^2-x-1
1.32471795724 ok x^5-x^4-1
1.32471795724 ok x^5-x^2-x-1
Order 6
1.83928675521 ok x^6-x^5-x^4-x^2-x-1
1.61803398875 ok x^6-x^5-x^4+x^2-x-1
1.46557123188 ok x^6-x^5-x^4+x^3-x^2+x-1
1.61803398875 ok x^6-x^5-x^3-x-1
1.46557123188 ok x^6-x^5-x^2-1
1.46557123188 ok x^6-x^5+x^4-x^3-x^2-x-1
1.32471795724 ok x^6-x^4-x-1
Order 7
1.83928675521 ok x^7-x^6-x^5-x^4+x^3-x^2-x-1
1.61803398875 ok x^7-x^6-x^5+x^2-x-1
...
1.32471795724 ok x^8-x^6-x^2-x-1
1.32471795724 ok x^8-x^5-x^4-x-1
884 candidates (1<root<2)
59 candidates (quasi-integer powers)


Quite disappointing since I got only ... 7 unique constants.

Here is my HP71 working program:

10 ! --- SSMC21 ---
20 OPTION BASE 0 @ DIM A(10)
30 C=0 @ C2=0
40 FOR D=2 TO 8
50 DISP "Order";D
60 DIM A(D) @ COMPLEX R(D-1)
70 A(0)=1
80 A(D)=-1 ! assumed...
90 K=3^(D-1) ! numbers of coefficient combinaisons
100 FOR J=0 TO K-1
110 L=J
120 ! build the coefficients
130 FOR I=D-1 TO 1 STEP -1
140 A(I)=MOD(L,3)-1 @ L=L DIV 3
150 NEXT I
160 ! find roots of polynomia A
170 MAT R=PROOT(A)
180 ! DISP "Polynomia";J
190 ! MAT DISP A
200 ! DISP "Roots"
210 ! MAT DISP R
220 X=REPT(R(D-1))
230 IF IMPT(R(D-1))=0 AND X>1.000001 AND X<2 THEN GOSUB 300
240 ! PAUSE
250 NEXT J ! next polynomia of order D
260 NEXT D ! next order polynomiae
270 DISP C;"candidates (1<root<2)"
280 DISP C2;"candidates (quasi-integer powers)"
290 END
300 ! evaluate candidate
310 'T':
320 C=C+1
330 ! DISP "Candidate x=";X
340 ! MAT DISP A
350 F=0 ! flag candidate found
360 N=20
370 Y=X^N
380 IF ABS(FP(Y)-.5)>.49 THEN F=F+1 ELSE F=0
390 N=N+1
400 IF Y<1E10 AND N<80 AND F<3 THEN 370 ! no need to go beyong 1E10 or power 80
410 ! IF X=1.38027756910 THEN PAUSE
420 IF F<3 THEN 530
430 C2=C2+1
440 FIX 11 @ DISP X;"ok"; @ STD
450 DISP " x^";STR$(D);
460 FOR I=1 TO D-1
470 IF A(I)=1 THEN DISP "+";
480 IF A(I)=-1 THEN DISP "-";
490 IF A(I)<>0 THEN DISP "x";
500 IF A(I)<>0 AND D-I<>1 THEN DISP "^";STR$(D-I);
510 NEXT I
520 DISP STR$(A(D))
530 ! PAUSE
540 RETURN
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Short & Sweet Math Challenge #21: Powers that be - J-F Garnier - 11-08-2016 03:15 PM



User(s) browsing this thread: 3 Guest(s)