Created
January 31, 2012 13:54
-
-
Save Mic92/1710603 to your computer and use it in GitHub Desktop.
Aufgabe 10 für 3.Feb 2012
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aufgabe a) | |
1) Münze 200 wird 12mal gedreht! | |
da Primzahlzerlegung 200=2^3*5^2 | |
da |{2^0, 2^1, 2^2, 2^3}| * |{5^0, 5^1, 5^2}| | |
= 4 * 3 = 12 | |
2) Folgende Münzen werden auch 12mal gedreht: | |
60: [2, 2, 3, 5] | |
72: [2, 2, 2, 3, 3] | |
84: [2, 2, 3, 7] | |
90: [2, 3, 3, 5] | |
96: [2, 2, 2, 2, 2, 3] | |
108: [2, 2, 3, 3, 3] | |
126: [2, 3, 3, 7] | |
132: [2, 2, 3, 11] | |
140: [2, 2, 5, 7] | |
150: [2, 3, 5, 5] | |
156: [2, 2, 3, 13] | |
160: [2, 2, 2, 2, 2, 5] | |
198: [2, 3, 3, 11] | |
200: [2, 2, 2, 5, 5] | |
3) Folgende Münzen werden häufiger als 12mal gedreht: | |
120: [2, 2, 2, 3, 5] | |
144: [2, 2, 2, 2, 3, 3] | |
168: [2, 2, 2, 3, 7] | |
180: [2, 2, 3, 3, 5] | |
192: [2, 2, 2, 2, 2, 2, 3] | |
Aufgabe b) | |
200^2 = 40000 = 2^6*5^4 | |
Kombination aller Primzahlprodukte mit gerader Anzahl | |
2^{0,2,4,6} mit 5^{0,2,4} => 4*3 = 12 | |
2^0*5^0 = 1 | |
2^0*5^2 = 25 | |
2^0*5^4 = 625 | |
2^2*5^0 = 4 | |
2^2*5^2 = 100 | |
2^2*5^4 = 2500 | |
2^4*5^0 = 16 | |
2^4*5^2 = 400 | |
2^4*5^4 = 10000 | |
2^6*5^0 = 64 | |
2^6*5^2 = 1600 | |
2^6*5^4 = 40000 | |
Aufgabe c) | |
Teilmengen: | |
[] | |
[5] | |
[5, 5] | |
[2] | |
[2, 5] | |
[2, 5, 5] | |
[2, 2] | |
[2, 2, 5] | |
[2, 2, 5, 5] | |
[2, 2, 2] | |
[2, 2, 2, 5] | |
[2, 2, 2, 5, 5] | |
Läuft auf ein 2dimsionales Diagramm raus... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#Encoding: UTF-8 | |
def primfactors(n) | |
return [] if n == 1 | |
factor = (2..n).find {|x| n % x == 0} | |
[factor] + primfactors(n / factor) | |
end | |
draws = Array.new(200, 0) | |
# 200 Schüler | |
(1..200).each do |i| | |
# 200 Münzen | |
(i..200).each do |j| | |
draws[j-1] = draws[j-1] + 1 if j % i == 0 | |
end | |
end | |
draws200 = draws[199] | |
puts "Aufgabe a)" | |
puts "1) Münze 200 wird #{draws200}mal gedreht!" | |
puts "da Primzahlzerlegung #{2**3*5**2}=2^3*5^2" | |
puts "da |{2^0, 2^1, 2^2, 2^3}| * |{5^0, 5^1, 5^2}|" | |
puts " = 4 * 3 = 12" | |
puts "2) Folgende Münzen werden auch #{draws200}mal gedreht:" | |
draws.each_index do |i| | |
puts "#{i+1}: #{primfactors i+1}" if draws[i] == draws200 | |
end | |
puts "3) Folgende Münzen werden häufiger als #{draws200}mal gedreht:" | |
draws.each_index do |i| | |
puts "#{i+1}: #{primfactors i+1}" if draws[i] > draws200 | |
end | |
puts | |
puts "Aufgabe b)" | |
puts "200^2 = #{2**6*5**4} = 2^6*5^4" | |
puts "Kombination aller Primzahlprodukte mit gerader Anzahl" | |
puts "2^{0,2,4,6} mit 5^{0,2,4} => 4*3 = 12" | |
(0..6).each do |exp1| | |
(0..4).each do |exp2| | |
if exp1.even? and exp2.even? then | |
puts "2^#{exp1}*5^#{exp2} = #{2**exp1 * 5 **exp2}" | |
end | |
end | |
end | |
puts | |
puts "Aufgabe c)" | |
puts "Teilmengen: " | |
(0..3).each do |i| | |
(0..2).each do |j| | |
print Array.new(i, 2) + Array.new(j, 5), "\n" | |
end | |
end | |
puts "Läuft auf ein 2dimsionales Diagramm raus..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment