This sounds like it should be good motivation to build a version of J
which uses some external bignum library.

I would expect more than a factor of 3 speed improvement for basic arithmetic.

The trick, of course, is making sre that the result is correct -t that
there are no circumstances where this change leads to a crash.

Also realize that this would be a tradeoff. J's arbitrary precision
(and rational) numbers are optimized for fast display, and that would
be slower with something like gmp.

Thanks,

-- 
Raul


On Thu, Oct 15, 2015 at 3:14 PM, Mike Day <[email protected]> wrote:
> FYI,  Project Euler problems 4, 36, 125, 486 involve
> palindromic numbers.
>
> They're publicly available at
> https://projecteuler.net/archives
>
> I think the earlier ones are quite straightforward.
> 125 concerns palindromes that are the sums of consecutive
> non-zero squares,  such as 595 = +/*: 7 8 9 10 11 12 , and
> is perhaps quite interesting. The problem is to sum all such
> palindromes < 1e8.
>
> 486 has only been solved by 132 punters in the year since
> it was first posted.  As usual,  the difficulty lies in obtaining
> a solution for the given extreme problem size.  It doesn't
> really concern palindromic numbers,  though,  since they're
> boolean,  or members of a two-letter alphabet if you wish
> to regard them as such.
>
>
>    "Palindrome-containing strings
>
>
>      Problem 486
>
> Let F_5 (n) be the number of stringsssuch that:
>
>  * sconsists only of '0's and '1's,
>  * shas length at mostn, and
>  * scontains a palindromic substring of length at least 5.
>
> For example, F_5 (4) = 0, F_5 (5) = 8, F_5 (6) = 42 and F_5 (11) = 3844.
>
> Let D(L) be the number of integersnsuch that 5 ≤ n ≤ Land F_5 (n) is
> divisible by 87654321.
>
> For example, D(10^7 ) = 0 and D(5·10^9 ) = 51.
>
> Find D(10^18 ).
> "
>
> My solution in J takes far too long, ~ 3 minutes, compared with
> the stated Euler target of less than a minute.
>
> I have a Pari GP solution, too, but can't remember how to get it
> to reproduce the result!
>
> Mike
>
>
>
> On 15/10/2015 18:02, Kip Murray wrote:
>>
>> Please read below. Forwarding is the only way I can get my awkward mailer
>> to send you a message with copied material! --Kip Murray
>>
>> ---------- Forwarded message ---------
>> From: km <[email protected]>
>> Date: Thu, Oct 15, 2015 at 11:44 AM
>> Subject: Finding prime palindromes
>> To: Kip Murray <[email protected]>
>>
>>
>> A prime palindrome is a prime which is unchanged when its decimal digits
>> are reversed.  Write verb  find  below.
>>
>>    p: i.40  NB. first 41 primes
>> 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101
>> 103 107 109 113 127 131 137 139 149 151 157 163 167 173
>>
>>     find i.40  NB. palindromes among the first 41 primes
>> 2 3 5 7 11 101 131 151
>>
>> --Kip Murray
>>
>> Sent from my iPad
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to