Einzelnen Beitrag anzeigen

Benutzerbild von 3_of_8
3_of_8

Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
 
Turbo Delphi für Win32
 
#8

Re: Primzahlen berechnen mit nur wenigen Befehlen

  Alt 16. Okt 2008, 16:12
Zitat von chamop87:
Zitat:
Tipp: Eine Zahl n ist eine Primzahl, wenn sie durch keine natürliche Zahl von 2 bis Wurzel(n) teilbar ist. (Ausnahme: Die 1 ist auch keine)
zwei ist auch eine primzahl, weil sie nur durch 2 und 1 teilbar ist!
Und? Für n:=2 ist aber deine rechte Intervallgrenze (sqrt(2)) kleiner als die linke Intervallgrenze (2), sodass du überhaupt keine Zahl überprüfst, wenn du den von mir vorgeschlagenen Algorithmus anwendest.
Manuel Eberl
„The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
  Mit Zitat antworten Zitat