That is not giving the correct answer 43 for the first 15 primes
(10 +/@:#: p:@:i.) 15
68
([: +/ [: > [: ".&.> [: [ [: {.&.> [: [ [: ":&.>@p: i.) 15
43
2010/11/16 Dan Bron <[email protected]>
> Björn wrote:
> > The objective is to get the first number from a list of primes.
> >
> > Is there a better way of getting the first number from a list of numbers
> > putting them each in a box than making it first a character and the
> taking
> > the first of each element making it a number and summing up the resulting
> > list?
>
> I've always preferred to ask for digits directly (numerically), rather than
> projecting into the string domain and returning to the numeric domain:
>
> 10 +/@:#: p:@:i.
>
> -Dan
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: [email protected]
gsm: +3546985532
sími: +3544781286
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm