hudson                 package:magic                 R Documentation

_P_a_n_d_i_a_g_o_n_a_l _m_a_g_i_c _s_q_u_a_r_e_s _d_u_e _t_o _H_u_d_s_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Returns a regular pandiagonal magic square of order 6m+1/6m-1
     using a method developed by Hudson.

_U_s_a_g_e:

     hudson(n = NULL, a = NULL, b = NULL)

_A_r_g_u_m_e_n_t_s:

       n: Order of the square, n=6m+/-1.  If 'NULL', use the length of
          'a'

       a: The first line of Hudson's A matrix.  If 'NULL', use Hudson's
          value of 'c(n-1,0:(n-2))'.

       b: The first line of Hudson's B matrix.  If 'NULL', use Hudson's
          value of 'c(2:(n-1),n,1)'. Using default values for 'a' and
          'b' gives an associative square. 

_D_e_t_a_i_l_s:

     Returns one  member of a set of regular magic squares of order
     n=6m+/-1.  The set is of size (n!)^2.

     Note that 'n' is not checked for being in the form 6n+1/6n-1.  If
     it is not the correct form, the square is normal but not
     necessarily magic.

_A_u_t_h_o_r(_s):

     Robin K. S. Hankin

_R_e_f_e_r_e_n_c_e_s:

     C. B Hudson, "On pandiagonal squares of order 6t +/- 1",
     Mathematics magazine, March 1972, pp94-96

_S_e_e _A_l_s_o:

     'recurse'

_E_x_a_m_p_l_e_s:

     hudson(n=11)
     magicplot(hudson(n=11))
     is.associative(hudson(n=13))
     hudson(a=(2*1:13)%%13 ,  b=(8*1:13)%%13)
     all(replicate(10,is.magic(hudson(a=sample(13),b=sample(13)))))

