#OK to post homework #Ariana Yousafzai, 10/4/2020, Assignment 8 #Question 1 The number of 10-letter words in the alphabet {1,4,6} that add-up to 201: The number of words in the alphabet {2,3,7} of ANY length, that add-up to 41: The number of sequences of any length whose entries are either 1 (mod 5) or 4 (mod 5) and that add up to 341: #Question 2 Pnk := proc(n, k) local k1, beth, b, S; option remember; if n = 1 then if k = 1 then RETURN({[1]}); else RETURN({}); end if; end if; if n = k then RETURN({[n]}); end if; if k <= 0 or n < k then RETURN({}); end if; S := {}; for k1 to k do beth := Pnk(n - k, k1); S := S union {seq([k, op(b)], b in beth)}; end do; S; end proc #Question 3 #pnk(n,k): the number of partitions of n whose largest part is k pnk:=proc(n,k) local S,k1: option remember: if n=1 then if k=1 then RETURN(1): else RETURN(0): fi: fi: if n=k then RETURN(1): fi: if k<=0 or k>n then RETURN(0): fi: add(pnk(n-k,k1),k1=1..k): end: #Question 4 #pn(n): the number of integer-partitions of n pn:=proc(n) local k: option remember: add(pnk(n,k),k=1..n): end: seq(pn(n), n = 0 .. 0.30); 0 #Question 5 [seq(p(5*n + 4) mod 5, n = 1 .. 50)] [p(9), p(14), p(19), p(24), p(29), p(34), p(39), p(44), p(49), p(54), p(59), p(64), p(69), p(74), p(79), p(84), p(89), p(94), p(99), p(104), p(109), p(114), p(119), p(124), p(129), p(134), p(139), p(144), p(149), p(154), p(159), p(164), p(169), p(174), p(179), p(184), p(189), p(194), p(199), p(204), p(209), p(214), p(219), p(224), p(229), p(234), p(239), p(244), p(249), p(254)] [seq(p(7*n + 5) mod 7, n = 1 .. 50)] [p(12), p(19), p(26), p(33), p(40), p(47), p(54), p(61), p(68), p(75), p(82), p(89), p(96), p(103), p(110), p(117), p(124), p(131), p(138), p(145), p(152), p(159), p(166), p(173), p(180), p(187), p(194), p(201), p(208), p(215), p(222), p(229), p(236), p(243), p(250), p(257), p(264), p(271), p(278), p(285), p(292), p(299), p(306), p(313), p(320), p(327), p(334), p(341), p(348), p(355)] [seq(p(11*n + 6) mod 11, n = 1 .. 50)] [p(17), p(28), p(39), p(50), p(61), p(72), p(83), p(94), p(105), p(116), p(127), p(138), p(149), p(160), p(171), p(182), p(193), p(204), p(215), p(226), p(237), p(248), p(259), p(270), p(281), p(292), p(303), p(314), p(325), p(336), p(347), p(358), p(369), p(380), p(391), p(402), p(413), p(424), p(435), p(446), p(457), p(468), p(479), p(490), p(501), p(512), p(523), p(534), p(545), p(556)]