[Jprogramming] i.y for big y

'Mike Day' via Programming programming at jsoftware.com
Sat Dec 2 09:35:09 UTC 2023


I was hoping to say I had a brilliant solution to problem 413,  but although I do have 
a script, p413.ijs,  it consists only of the statement of the puzzle.  It's one of those 
many I'll get back to, some day.  (There was a short period when I'd solved 100%)

The first hundred or so were, I think, written by one chap, at a time when PCs were 
not so powerful as now.  APL and J were great for brute-force,  but still quite elegant, 
solutions.  Not so now!  They're still marvellous,  but there's (nearly?) always a mathematical approach which will crack the Euler-nut.  

Good Luck.

Mike
(Sorry - far too chatty,)

Sent from my iPad

> On 2 Dec 2023, at 07:07, 'Viktor Grigorov' via Programming <programming at jsoftware.com> wrote:
> 
> Hey,
> 
> Excuse the possibly inappropriate title. Many projecteuler.net past the first, say, 80 problems are or seem to be hard to brute force, at least the way I want to write J code. For .https://projecteuler.net/problem=413 for example, the below verb does the job, but 1e19 is a bit too big an input. The 2. root is too big an input.
> 
> {{w=.0 for_q.i.y do.w=.w+(([:(1=#)[:(#~(0=z|]))[:;[:"."1&.>[:([:(((- at i.@#@(#~((32{a.)~:]))@{.){]))[:|.(]\))&.>[:<"1(1&}.)^:(i.z=.#q))q=.":q)end.<:w}}
> 
> Is getting such a sentence to run down to inserting all applicable special combinations, altering internal parameters (like comparison tolerance) via foreigns, making it all explicit, and or something else? The problem here  is mostly i.1e9 filling my RAM and swap in a blink. Something like flushing the buffer, or consistently outputting would be nice.
> 
> Any suggestions or recommendations would be appreciated.
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


More information about the Programming mailing list