To correct my own somewhat irrelevant mistake,
today's problem 484 concerns "arithmetic
derivative" with n=1e15. I don't know where that
Möbius came from! Sorry...
Mike
On 12/10/2014 14:21, Mike Day wrote:
Afraid not, but it appears that Linda's ff verb is correct,
returning 1999998 as the area for the required rectangle.
It's frowned on to publish the answer.
I wish I could find my own solution to this; I evidently
did solve it, probably some years ago, as I can "see" the
right answer displayed when I log in to Project Euler
and look at problem 85.
I can't find any solution in my files, be it J or APL or
Fortran, let alone Python (which I don't really get yet)
or Pari GP, which I use when I can't get sufficient
precision from J (probably my own limitations rather
than J's).
Though, fwiw, I was having trouble last week with p482,
about incircles and stuff, running slow and wrong in J,
and recoded it in Pari GP. I got the same answer and
about 5 times slower in Pari GP! I eventually spotted the
lacuna and got a J solution running in about 1 1/2 hours.
It appears to me that PE problems have increased in
both mathematical difficulty and programming
complexity over the years. If Problem 85 were to be
problem 485, that 2 million might now be 2e9 or
worse. Perhaps not, as I can't remember my algorithm!
I did achieve solving all problems some ago, when there
were fewer than 200, but I'm 90 odd behind now.
Meanwhile, seeing if I can solve last weekend's problem
483 (prima facie about permutations and cycles). Today's
(484) concerns a Möbius function with n=20 000 000;
haven't thought about it at all yet, although 18 have
already solved it.
Mike
On 12/10/2014 11:30, Linda Alvord wrote:
At the moment, I'm rooting for 54 by 54 as the answer!
ff=: 13 :'(>:i.x) */>:i.y'
f=: 13 :'*/~ >:i.y'
(7 ff 7)-:f 7
good=: 13 :'}:1,x>+/\,y'
sum=: 13 :'+/(x good y)#, y'
400 < 400 sum 5 ff 5
400 < 400 sum 6 ff 6
400 < 400 sum 7 ff 7
400 sum f 6
400 sum f 7
400 sum f 8
6 ff 6
400 sum 6 ff 6
2e6 < 2e6 sum 52 ff 52
2e6 < 2e6 sum 53 ff 53
2e6 < 2e6 sum 54 ff 54
2e6 sum f 53
2e6 sum f 54
2e6 sum f 55
2e6 sum 54 ff 54
This stays in 2 dimensions.
Linda
-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul
Miller
Sent: Saturday, October 11, 2014 6:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Project Euler 85, Python and J
I understand that boxed index lists can be used to index
multi-dimensioned
arrays. And that can be a convenient abstraction.
However, I have been dealing with very large datasets recently, and
boxed
data on the critical path, at least for some operations, becomes
prohibitively slow.
When I can use regular numeric structures to replace irregular boxed
structures, the overall speedup from the representation change
usually more
than makes up for the cost of changing representation.
Thanks,
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4765 / Virus Database: 4040/8373 - Release Date: 10/12/14
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm