This repository was archived by the owner on Feb 15, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed
Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33# Visual Studio Version 16
44VisualStudioVersion = 16.0.28315.86
55MinimumVisualStudioVersion = 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}"
77EndProject
88Global
99 GlobalSection (SolutionConfigurationPlatforms ) = preSolution
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments