Category: C#

  • Optimized prime number generator

    Same specs as previous system, 8 hours to find all primes to ULONG_MAX. #include <stdio.h>#include <malloc.h>#include <limits.h>#include <math.h>struct linked_list{ unsigned long number; struct linked_list *next;};int main(int argc, char **argv){ unsigned long divisor, max_divisor, prime_test; unsigned long max_prime_to_store; struct linked_list *first=NULL, *current=NULL, *last=NULL; first=(struct linked_list *)malloc(sizeof(struct linked_list)); first->number = 2L; first->next = NULL; last = first;…

  • I miss C programming. Program to find prime numbers

    Uses unsigned long long, goes up to ULONG_LONG_MAX. Intel Core Duo 2 processor, running Cygwin on Windows XP, and compiled using gcc 3.4.4. Stops at first million results due to time. Can reasonably get to 10 million, if you’re willing to wait. #include <stdio.h>#include <math.h>#include <limits.h>int main(int argc, char **argv){ unsigned long long divisor, max_divisor,…

  • “Playtime” project: Porting Didiwiki to C#.NET

    I’m hoping to find time to throw at least a quick port of DidiWiki to C#.NET together. Reference 1: Creating your own Web Server using C# – This article is from 2001, so there might be a significantly better way of doing things. Update: This CodeGuru page looks like a more original version of the…