Number  theory  is  the  branch  of  pure  math-  ematics  that  studies  the  properties  of  the  integers.  Thinking  about  properties  of  integers  can  be  rec-  reational  as  well  as  performed  by  mathematicians.  In  the  past,  a  common  quest  was  to  find  formulas  to  calculate  the  sums  of  powers  of  integers.  Be-  cause  there  were  no  computers  to  calculate  these  sums  of  powers,  number  theorists  developed  for-  mulas  to  find  sums  of  powers  of  integers  indirectly.  Bernoulli  numbers  were  developed  by  Swiss  math-  ematician  Jakob  Bernoulli  in  the  late  17th  century.  These  numbers  were  used  in  a  complex  formula  to  calculate  the  sums  of  powers  of  integers  quickly  well,  relatively  quickly.  It  was  still  a  labor-intensive  calculation.  Today,  computers  can  be  used  to  solve  this  problem.  A  computer  can  calculate  the  sums  of  powers  of  integers  directly  and  almost  instanta-  neously  without  Bernoulli  numbers.  Examples  of  this  task  are  shown  below.  Example  1  This  example  shows  the  calculation  of  the  sum  of  the  first  five  powers  of  3  directly.  Powers  of  3  Sum  of  Powers  of  3  30  =  1  1  31  =  3  4  32  =  9  13  33  =  27  40  34  =  81  121  Example  2  This  example  shows  the  calculation  of  the  sum  of  the  first  four  powers  of  10.  Powers  of  10  Sum  of  Powers  of  10  100  =  1  1  101  =  10  11  102  =  100  111  103  =  1000  1111  Assignment  1  Apply  what  you  have  learned  about  computa-  tional  thinking  to  write  an  algorithm  for  calculat-  ing  the  sums  of  powers  of  integers.  Allow  input  of  any  integer.  Calculate  the  sum  of  the  first  100  powers  of  that  integer.  Follow  the  four  actions  of  computational  thinking.  Assignment  2  Study  Example  2  above  for  calculating  the  sums  of  the  powers  of  10.  Look  for  a  pattern  in  the  sums.  Write  a  shortcut  algorithm  to  find  the  sum  of  any  number  of  powers  of  10.  Follow  the  four  ac-  tions  of  computational  thinking.  Math  and  Java  Sums  of  Powers  Algorithm  Chapter  1  Computational  Thinking  11  Copyright  Goodheart-Willcox  Co.,  Inc.