Problem 484 is still on my to-do list.  I haven't looked at it in a 
while,  but
my working script includes a remark:
NB. ... suggests a 
sieve might be ok - but for 5e15????!!!
Also,  I seemed to be trying to 
use a moebius function or
Moebius' Theorem...


As I haven't managed to 
solve it yet,  I don't suppose that is a serious spoiler!!!!

Currently 
stuck on many of the 500s - they don't get easier,


Mike

On 
11/07/2015 02:36, Raul Miller wrote:
> I don't do project euler, I've 
never really gotten into it. But my
> impression is that the problems 
are chosen to make brute force
> solutions impractical.
>
> Here, I 
think I see a pattern in the relationship between >./@(_&q:)
> and func 
(for your definition of func) and I expect that the mechanism
> behind 
that relationship will be worth exploring.
>
> Good luck,
>
(Earlier,   
Jon Hough wrote:)



Project Euler #484
https://projecteuler.net/problem=484is particularly troublesome. My 
solution is:








f =: monad define
T =: 5 * 10^15
ctr=:1
sum =: 0

func=:+.(+/@:(1&(*/\.))@:q:)
while. ctr < T + 1 do.


sum =: sum + func 
ctr
ctr =: ctr+1
end.
sum
)

But on my Mac this causes a crash. (Doing 
a tacit one-liner 
with +/ gives an out of memory error). So I am at a 
loss how 
to do this in J.  10^15 seems absurdly large, so perhaps 
I'm 
missing a trick.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to