Post Reply 
Decimal digits vs integer digits
02-22-2018, 12:14 AM (This post was last modified: 02-22-2018 12:46 AM by Valentin Albillo.)
Post: #6
RE: Decimal digits vs integer digits
.
Hi again,

(02-21-2018 10:02 PM)pier4r Wrote:  Anyway I wrote "and it is not derived from a power of two, like the Marsenne primes", exactly because many large numbers, that have a large integer part, that I saw are power of two with some (relatively small) additions or subtractions.
Take 5 result to compute: 2^{65536} - 3

This is irrelevant, the 9-line routine in the link I posted is a general integer x^y procedure, which in the link was merely particularized to the case 2^65536-3 in order to run as fast as possible, which was necessary considering the 19729-digit result.

Just changing a few constants here and there and removing an unnecessary MOD and the final "-3" will particularize it for your 345^678 case, namely:

HP-71B BASIC 276 bytes

1 DESTROY ALL @ OPTION BASE 0 @ N=678 @ M=9 @ DIM A(1) @ K=10^M
2 A(0)=1 @ P=0 @ R=345 @ FOR J=0 TO N-1 @ MAT A=(R)*A @ GOSUB 7
3 IF NOT MOD(J,3) THEN DIM A(UBND(A,1)+1)
4 NEXT J @ J=0 @ DISP @ DISP STR$(A(P));
5 FOR I=P-1 TO 0 STEP -1 @ J=J+1 @ IF J=8 THEN DISP @ J=0
6 A$=STR$(A(I)) @ DISP RPT$("0",M-LEN(A$));A$; @ NEXT I @ DISP @ END
7 FOR I=0 TO P @ A(I+1)=A(I+1)+A(I) DIV K @ A(I)=MOD(A(I),K) @ NEXT I
8 P=P+SGN(A(P+1)) @ RETURN


>RUN

       43787127894257936017120551659989811782288595515354488987325413900
802341364764426050357758027764875852954092964869040837522986085325699173
440208660552897860597656352894886234825033019524427828510385113091870587
005237979574624235528306024867516223687363549218278200731353323503043912
120989668489236868998861750420042665298754353038576710971046242429801586
669131859077306402007714558887393358830404516840817948233451328963360193
114563267109108960521839713831465439944710989493035683991255640279032860
581765608574303767665601432793221493427233670620749461059260365310968431
585830459166695451811726296981933487119148771459810108174762065159568198
407266299590937256706240056624384072905607134849197301523581457759856051
111607090600538618993962407324224698618801995078569897879194293395864756
550058758882360360608188838042731105482307344218732065369684380408154422
235201486556127538160893294416739548640206983367006318379868072916894831
076832048085751609655811267096468212505533782955677349524900995963177834
200313830363586547412870379485068164058291348085768726434048158469207076
703493830888308971397858159094316029849039124281681570344592276962513399
638111721953436191496696440051270541907304501831480363885440523615788049
760816385876587151965017830052548542015425762584641347565586651012967162
073436892709365750805457343388826858826999648631383565305483943145460008
131395931429816939097414831715038496546088196375343408059976593548460657
131204675259681017973097295388536257824843287263600409978735955744310463
706641029042353833038949463564702481944217729382576380928106704511758276
752884386737114453127433596534637098769025716578727297063727391809360711
921656764151908265461416144338248346290498602684237994253635406494140625


This takes just 19 seconds in Emu71 on a very old pc to get the 1721-digit result you saw above.

Quote:PS: Valentin, how is going with the place for publishing your contributions? Was the wiki not enough?

I'm still not satisfied with the options I've been looking, my ideal continues to be some HP-fan who would kindly host my files but meanwhile I'm still looking and the materials continue to accumulate, which is bad if I can't get them available somewhere. I think I've got enough for a dozen articles and scores of challenges and short columns.

Thanks for your interest and best regards.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Decimal digits vs integer digits - pier4r - 02-21-2018, 11:22 AM
RE: Decimal digits vs integer digits - Valentin Albillo - 02-22-2018 12:14 AM



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