Horje
largest prime factor C# Code Example
largest prime factor C#
		static long LargestFactor(long n)
        {
            long lastFactor;
            if (n%2==0)
            {
                lastFactor = 2;
                n/=2;
                while (n % 2 == 0)
                    n/=2;
            }
            else
            {
                lastFactor = 1;
            }
            long factor = 3;
            long maxFactor = Convert.ToInt64(Math.Sqrt(n));
            while (n > 1 && factor <= maxFactor)
            {
                if(n % factor == 0)
                {
                    n/=factor;
                    lastFactor=factor;
                    while (n % factor == 0)
                        n/= factor;
                    maxFactor = Convert.ToInt64(Math.Sqrt(n));
                }
                factor += 2;
            }
            if (n == 1)
                return lastFactor;
            else
                return n;
        }




Csharp

Related
my context class is in different project and i want migration in different project in asp.net mvc Code Example my context class is in different project and i want migration in different project in asp.net mvc Code Example
c# 9.0 dynamic nedir Code Example c# 9.0 dynamic nedir Code Example
worldtimebuddy Code Example worldtimebuddy Code Example
create cursor in NETEZZA Code Example create cursor in NETEZZA Code Example
entityframework command to build model from database Code Example entityframework command to build model from database Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11