
Programda gorsel acidan hic bir degisiklik yapilmamistir.. Ilk baslikta acilan ayni ogeler kullanilmaktadir.Sadece bazi kodlar eklenmistir. Ilk basliga ulasmak icin buraya tiklayin..
Eklenen Ozellikler
Bilindigi uzere program 2'den kendisine kadar her sayiya bolunuyor ve bolumler kontrol ediliyor..ilk baslarda sorun yok ama daha sonra program dogal olarak yavasliyor.. bende 2046 sayisi zaten cift sayi hic sorgulamasin diyerekten birkac bolunebilme kurallari ekledim.. Sorgulanan sayi cift ise hic sorgulamayip diger sayiya geciyor misal.. biraz da olsa program hizlaniyor..2'ye
3'e
5'e
bolunebilme kodlari eklenmistir..
Kodlar:
PHP Code:
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
Timer2.Stop()
End Sub
Public Shared Function CheckInteger(ByVal strVal As [String]) As Boolean
Dim reg As New Regex("[^0-9-]")
Dim reg2 As New Regex("^-[0-9]+$|^[0-9]+$")
Return (Not reg.IsMatch(strVal) AndAlso reg2.IsMatch(strVal))
End Function
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
List.Items.Clear()
count.Text = count.Text + 1
Dim bolum As String
Dim bolunebilme As Boolean
bolunebilme = CheckBolunebilme(count.Text)
If bolunebilme = True Then
Durum.Items.Add(count.Text & " Asal Sayi Degildir")
Timer1.Stop()
Timer1.Start()
Else
For i = 2 To count.Text - 1
bolum = count.Text / i
List.Items.Add(bolum)
Next
Timer1.Stop()
Timer2.Start()
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If List.Items.Count 0 Then
Dim check As Boolean
check = CheckInteger(List.Items(0))
If check = True Then
Timer2.Stop()
Durum.Items.Add(count.Text & " Asal Sayi Degildir")
Timer1.Start()
Else
List.Items.RemoveAt(0)
End If
Else
Asalsayilar.Items.Add(count.Text)
Timer2.Stop()
Durum.Items.Add(count.Text & " Asal Sayidir")
My.Settings.Enbuyuk = count.Text
My.Settings.Save()
My.Settings.Reload()
Label4.Text = "Bulunan En Buyuk Asal sayi : " & My.Settings.Enbuyuk
Timer1.Start()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1
Timer2.Interval = 1
Label1.Text = "Asal Sayilar"
Label3.Text = "Bildirimler"
Label2.Text = "Sorgulanan Sayi :"
Dim x As Integer = My.Settings.Enbuyuk
If x