Skip to content
This repository was archived by the owner on Feb 15, 2020. It is now read-only.

Commit 9f4d49b

Browse files
committed
upd
1 parent a340a72 commit 9f4d49b

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

eV.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.28315.86
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lib", "lib\lib.csproj", "{A7500702-EAEA-4FF1-9C47-F54C5EE7D2F7}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eV.Measure", "lib\eV.Measure.csproj", "{A7500702-EAEA-4FF1-9C47-F54C5EE7D2F7}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution

lib/eV.Measure.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<RootNamespace>eV.Measure</RootNamespace>
6+
<Authors>Yuuki Wesp</Authors>
7+
<PackageLicenseUrl>https://raw.githubusercontent.com/0xF6/eV/master/LICENSE</PackageLicenseUrl>
8+
<PackageProjectUrl>https://github.com/0xF6/eV</PackageProjectUrl>
9+
<RepositoryUrl>https://github.com/0xF6/eV</RepositoryUrl>
10+
<RepositoryType>git</RepositoryType>
11+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
12+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13+
<Copyright>2019 (C) Anders Gustafsson, Cureos AB, Yuuki Wesp</Copyright>
614
</PropertyGroup>
715

816
</Project>

lib/sys/PrimeNumbers.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace eV.Measure.sys
2+
{
3+
using System;
4+
using System.Collections;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
public sealed class PrimeNumbers : IEnumerable<int>
8+
{
9+
#region Implementation of IEnumerable
10+
public IEnumerator<int> GetEnumerator()
11+
{
12+
yield return 2;
13+
14+
var enumerator = OddInts().GetEnumerator();
15+
while (enumerator.MoveNext())
16+
{
17+
var x = enumerator.Current;
18+
var sqrt = Math.Sqrt(x);
19+
if (OddInts().TakeWhile(y => y <= sqrt).All(y => x % y != 0)) yield return x;
20+
}
21+
}
22+
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
23+
24+
#endregion
25+
26+
#region PRIVATE SUPPORT METHODS
27+
28+
public static IEnumerable<int> OddInts()
29+
{
30+
var start = 1;
31+
while (start > 0) unchecked
32+
{
33+
yield return start += 2;
34+
}
35+
}
36+
37+
#endregion
38+
}
39+
}

0 commit comments

Comments
 (0)