#import "@local/academ:0.2.2"
#image("Opgaveliste.png")
#image("opgave4.1-1.png")


#image("opgave5.png")
#academ.solution[
  When $a | b$ then we know that $b = a c$ where _c_ is an integer. We can do the same for $b | a$, so $a = b c$. When looking at the equations for a and b, we can conclude that c must be 1, because if it was bigger, the other equation would not hold. If b is 2a, then a must be $1/2 b$ but then c would not be an integer.

  It is the same thing for if a or b is negative, as then it would be that $c=-1$
]

#image("opgave4.1-9.png")
#academ.solution[
  When a devides b we know that _b_ must be a multiple of _a_. We also know that an even number multiplied by an integer will always give an even number, so if b is even, then a cannot be odd. And then if a is odd, then b must also be odd.
]
#image("opgave4.1-17.png")
#image("opgave4.1-21.png")

#image("opgave4.1-29.png")
#academ.solution[
  a) 1=228 *div* 119, 109 = 228 *mod* 119

  b) 40 = 9009 *div* 223, 89 = 9009 *mod* 223

  c) -31 = -10101 *div* 333, 222 = -10101 *mod* 333

  d) -21 = -765432 *div* 38721, 38259 = -765432 *mod* 38721
]

#image("opgave4.1-1.png")

#image("opgave4.1-41.png")
#academ.solution[
  When $n | m$ we know that m is a multiple of n. And when we say $a equiv b (mod m)$ we basically say that a and b is the same distance away from a multiple of m. But since we also know that m is a multiple of n, this means that a and b must be the same distance away from a multiple of n as well. 
]

#image("opgave4.1-43.png")
#academ.solution[
  a) This is false when $m=c$. Example: $a=19, b=18, c=5,m=5$.
  We would then have $ 19 dot 5 mod 5 = 18 dot 5 mod 5 <=> 95 mod 5 = 90 mod 5 <=> 0 = 0 $
  Which is true. But then:
  $ 19 mod 5 = 18 mod 5 <=> 4 = 3$
  Which is false.

  ~

  b) $a=-13, b=-23, c=5, d=15, m=10$.

  Proof:
  $ 
  -13 mod 10 = -23 mod 10 <=> 7 = 7\
  \
  5 mod 10 = 15 mod 10 <=> 5 = 5\
  \
  (-13)^(5) mod 10 = (-23)^(15) mod 10 <=> -371293 mod 10 approx -2.666352 dot 10^(20) <=>\
  7 = 3
   $
]
#image("opgave4.1-44.png")
#academ.solution[
  When you look at a table of a number of $n^2$ and $n^2-(n-1)^2$ you can see an interesting pattern:
  
  #table(
    columns: 3,
    align: horizon,
    table.header(
      [$n$],[$n^2$],[$n^2-(n-1)^2$],
    ),
    [2], [4], [3],
    [3], [9], [5],
    [4], [16], [7],
    [5], [25], [9],
    [6], [36], [11],
    [7], [49], [13],
    [8], [64], [15],
    [9], [81], [17],
    
  )
  On this table you can see that the difference between each $n^2$ grows by 2 for each _n_. This means that the difference is $n^2$ and $(n-1)^2$ is always $4 dot x plus.minus 1$. So as we can see, $n^2$ is always either a multiple of 4, or _a multiple of 4_ plus 1.
]
#image("opgave4.1-45.png")
#academ.solution[
  As seen on the table, $n^2$ is always either a multiple of 4, or _a multiple of 4_ +1. _m_ is always 1 below a multiple of 4, which makes it never be equal to the sum of the squares of two integers. This is because the sum of the squares of two integers will always either be 4k (when the squares of the two integers both are a multiple of 4), $4k+1$ (when one of the squares are a multiple of 4, and the other is a multiple + 1), or $4k+2$ (when both of the squares are a multiple of 4 + 1). So the sum of the squares of two integers will never equal $4k+3$
]
#image("opgave4.1-47.png")
#academ.solution[
  This is true because $a equiv a^k (mod m)$. We know this as when you for when you take $a^k$, the result will still be a multiple of a. So that means that you could rewrite $a^k$ as $a dot a^(k-1) dot a^(k-2) dots$. So if we call the $a^(k-1) dot a^(k-2) dots$ _l_, we can write $a=m dot c + d$ and $a dot l = m dot c dot l + d$.
]
#image("opgave4.1-51.png")

Dette er korrekt. eller er det
