Skip to content

Instantly share code, notes, and snippets.


Øyvind Skaar oyms

  • Bekk Consulting AS
  • Oslo
View GitHub Profile
View OverrideAndNew.cs
void Main()
var son = new Son();
BaseClass sonAsBase = new Son();

Keybase proof

I hereby claim:

  • I am oyms on github.
  • I am skaar ( on keybase.
  • I have a public key whose fingerprint is 9F79 8AB8 168B 9D7B 3128 0759 3CBB 5DAD C3BB 81D3

To claim this, I am signing this object:

View luke2
void Main()
var result = FindNumber(9);
Console.WriteLine (result);
public int FindNumber(int n){
var seed = n * (int) Math.Pow(10,n-1);
return FindNumber(seed, n-1, n, new Primes());
View gist:3db151d09d9b0b6fd59b
void Main()
var result= ParallelEnumerable.Range(1,10000000).Count(t=>IsPalindrome(t,8) && IsPalindrome(t,10));
Console.WriteLine (result);
public bool IsPalindrome(int number, int baseNumber){
var value = Convert.ToString(number, baseNumber);
return value == Reverse(value);
public string Reverse(string txt){
View Main.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
class Program
public static void Main()
oyms / Division.cs
Created Aug 17, 2012
Division without operators
View Division.cs
public static int Division(int divident, int divisor)
if (divisor == 0) throw new DivideByZeroException("Jeg tror aldri tidligere jeg har kunnet bruke denne");
var enumerator = Enumerable.Range(1, divident).GetEnumerator();
var lists = new List<int>[divisor];
foreach (var element in Enumerable.Range(0, divisor))
var list = lists[element] ?? (lists[element] = new List<int>());