oftware.com
Subject: Re: [Jprogramming] Euler Project Problem 1
Nice! I missed the summation part but overall this is much better.
Don Kelly
On 09/04/2014 5:06 AM, Nimp O wrote:
+./0=3 5 |/ i.1e3
--
For information about J foru
gt;
>> -----Original Message-----
>> From: programming-boun...@forums.jsoftware.com
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Kelly
>> Sent: Wednesday, April 09, 2014 7:00 PM
>> To: programm...@jsoftware.com
>> Subject: Re: [Jprogramm
m
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Kelly
> Sent: Wednesday, April 09, 2014 7:00 PM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Euler Project Problem 1
>
> Nice!
: [Jprogramming] Euler Project Problem 1
Nice! I missed the summation part but overall this is much better.
Don Kelly
On 09/04/2014 5:06 AM, Nimp O wrote:
> +./0=3 5 |/ i.1e3
--
For information about J forums see h
Nice! I missed the summation part but overall this is much better.
Don Kelly
On 09/04/2014 5:06 AM, Nimp O wrote:
+./0=3 5 |/ i.1e3
--
For information about J forums see http://www.jsoftware.com/forums.htm
Here is my Euler 1 solution for reference. It is concise and I think it's
pretty easy to understand.
+/I.+./0=3 5 |/ i.1e3
233168
It's the same as:
sum(indices(any(zero?(remainder table
27 33 35
Linda
-Original Message-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Kelly
Sent: Wednesday, April 09, 2014 12:01 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Euler Project Problem 1
sorry- I original
sorry- I originally used + which duplicated 15 where I should have
used or (+. )
On 08/04/2014 8:52 PM, Don Kelly wrote:
try=: 3 : '( (0=3|y)+.(0=5|y))#y' **or** try1=: ] #~ (0 = 3 | ]) +. 0
= 5 | ] *
*
try1 1+i.19
3 5 6 9 10 12 15 18
Don Kelly
On 08/04/2014 8:30 AM, Jon Hough wrote:
try=: 3 : '( (0=3|y)+.(0=5|y))#y' **or** try1=: ] #~ (0 = 3 | ]) +. 0 =
5 | ] *
*
try1 1+i.19
3 5 6 9 10 12 15 15 18
Don Kelly
On 08/04/2014 8:30 AM, Jon Hough wrote:
Euler Project #1 is:If we list all the natural numbers below 10 that are
multiples of 3 or 5, we get 3, 5, 6 and 9. The
A pencil and paper solution.
A problem with computers is that it is too easy to go for a brute-force
solution. Computers are great for solving problems with no simple solutions
by applying brute-force, but this isn't one.
The problem with adding together all multiples of 3 and 5 in the series 0
.
It may help if you knew how fork came about.
http://keiapl.org/rhui/remember.htm#fork0 http://keiapl.org/anec/#nvv It
was a long struggle. The triple aspect is integral to the idea.
On Tue, Apr 8, 2014 at 12:09 PM, Joe Bogner wrote:
> On Tue, Apr 8, 2014 at 11:48 AM, Jan-Pieter Jacobs <
>
On Tue, Apr 8, 2014 at 11:48 AM, Jan-Pieter Jacobs <
janpieter.jac...@gmail.com> wrote:
[snip]
> Other things to note are : you can use a for for dummy, and instead of
> multiplying with 1, it's easier to use the identity function (which, as a
> bonus works also for non-numeric types). Now a fork
riginal Message -
> From: Jon Hough
> To: "programm...@jsoftware.com"
> Cc:
> Sent: Tuesday, April 8, 2014 11:30:22 AM
> Subject: [Jprogramming] Euler Project Problem 1
>
> Euler Project #1 is:If we list all the natural numbers below 10 that are
> multiples of 3
Hough
To: "programm...@jsoftware.com"
Cc:
Sent: Tuesday, April 8, 2014 11:30:22 AM
Subject: [Jprogramming] Euler Project Problem 1
Euler Project #1 is:If we list all the natural numbers below 10 that are
multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum
Hey Jon,
It can be written in one go, try:
+/@result f.
This fixes the all verbs, converting a verb to it's constituent primitives.
That said, you are over-specifying your ranks. Ranks are there by default,
and as it happens = already has rank 0, so there is no use in setting the
ranks.
Other
Hi Jon,
Have you had a chance to watch the J in 10 minutes video that Martin Saurer
produced a few days ago (link below). About a minute in, Project Euler #1 is
used as an example to explain a J approach to the problem.
https://www.youtube.com/watch?v=OzaIi8BnHIc&list=PLLcTTp6EQ_egylIerYEjCBbE
-0400
> From: ircsurfe...@gmail.com
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Euler Project Problem 1
>
> Hey Jon,
>
> I remember seeing this done by someone before. They went about it like this:
> generate numbers 0 through 1000
> a = i.1000
> cr
Hey Jon,
I remember seeing this done by someone before. They went about it like this:
generate numbers 0 through 1000
a = i.1000
create a "mask" list of 0s and 1s where the numbers are divisible by 3 and 5
(pseudo code: b = a % 3 OR a % 5)
multiply the mask list and the number list together
and
a
Euler Project #1 is:If we list all the natural numbers below 10 that are
multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
In C/Java I could easily do something like:
int total =0;
for (int counter = 0; counter <
19 matches
Mail list logo