sumofhoursatvertices =: 6 * >:

Imagine the polygon with a vertex at hour 6%n.  This is clearly
symmetric left-right & therefore has total 6*n.  To get the polygon
called for in the problem, rotate CW by 1/2 the vertex spacing to
put the last vertex on the 12.  This adds 12%2n for each vertex, in
other words adds 6 in all.

Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron
> Sent: Friday, September 14, 2007 6:22 PM
> To: 'Programming forum'
> Subject: [Jprogramming] Clock-inscribed polygons
> 
> Provide a J verb that inscribes a regular polygon within a 
> (circular) 12-hour clock, and returns the sums of the hours at the
> vertices of the polygon.  One vertex must rest on 12.  
> 
> The verb is monadic and its argument is the sides of the 
> polygon.  If the vertices of the polygon do not fall perfectly on hour
> marks, you may either use fractional hours or raise an error.
> 
> -Dan
> 
> ----------------------------------------------------------------------
> For information about J forums see 
> http://www.jsoftware.com/forums.htm

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

Reply via email to