Challenge for you... - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7) +---- Thread: Challenge for you... (/showthread.php?tid=1629) |
RE: Challenge for you... - mnrvovrfc - 04-23-2023 (04-23-2023, 04:02 PM)david_uwi Wrote: A program for big factorials (not using strings). It was written to work with QB4.5 This program is very clever! The only way to be able to do very large integers without strings is with integer array. I had thought it needed many more calculations, more convoluted code to "piece" the snake together. RE: Challenge for you... - Kernelpanic - 04-23-2023 Quote:@David - A program for big factorials (not using strings). It was written to work with QB4.5 Functions! If Pete could see that. . . RE: Challenge for you... - bplus - 04-23-2023 (04-23-2023, 04:02 PM)david_uwi Wrote: A program for big factorials (not using strings). It was written to work with QB4.5 Very interesting, I wonder if can take place of String Math or do more tricks with this. RE: Challenge for you... - Jack - 04-23-2023 bplus from the looks of it the code does one digit at a time judging from the \ 10 and mod 10, it would be many times faster if you did more digits at a time RE: Challenge for you... - david_uwi - 04-23-2023 Yes loading the array with bigger numbers would make it quicker, but surprisingly not by much. Notice the WHILE...WEND loop I thought that was a nice touch and it's good we still have compatibility with GWBASIC. Anyway that's how big numbers are handled load as much as you can and use carries on overflow. RE: Challenge for you... - bplus - 04-23-2023 (04-23-2023, 05:36 PM)Jack Wrote: bplus And I do many digits at a time except maybe division in String Math but... all that String processing pays a price. Update: Wait I do division by multiplying with reciprocals, that's right. I was wondering if maybe do _Integer64 for maximizing number of integers maybe 12+ digits at a time? 6 of 1, half dozen of another...? RE: Challenge for you... - Jack - 04-23-2023 bplus, I think that 8 or 9 digits at a time would work, 9*9 digits = 18 digits RE: Challenge for you... - DANILIN - 04-28-2023 My prime program has been created that searches for prime numbers according to formula of origin topic but I feel an error in line s = s + (Cos(3.1416 * (f + 1) / j)) ^ 2 ' FORMULA Code: (Select All) n = 3: Print n: p = 0 ' nijprime.bas Willans 1964 I create a version of my prime program about primes in JavaScript where all numbers are long by copying save HTM or checked online https://jdoodle.com/h/2XK Moreover results of BAS & JS are same I think there is a mistake in formula Code: (Select All) <!DOCTYPE html> <html lang="en"> <head> 4 16 =1 =1 =2 =6 =24 =120 =720 =5040 =40320 =362880 =3628800 =39916800 =479001600 =6227020800 =87178291200 =1307674368000 15.582928489000466 https://jdoodle.com/h/2XK 1001 prime is 104743 06-06-2022, 08:15 PM https://qb64phoenix.com/forum/showthread...45#pid2945 long read https://rosettacode.org/wiki/10001th_prime RE: Challenge for you... - Jack - 04-28-2023 Hi DANILIN QB64 default type is single, this lame formula needs a lot of precision and a Quantum computer with an astronomical amount of RAM with double you can go as high as 6 see my implementation on page 1, I don't think that your implementation will work even with double |