I see, sorry for the confusion and thanks for clearing things up! ]]>

Thank you for your contribution. However my algorithm is a specific version of the 11-proof for the Dutch social security number called BSN, not to be confused with bank account numbers like IBAN. The number 755490975 is not a valid BSN indeed (see also this online BSN check).

I think your algorithm is the general 11-proof which is suitable for bank account numers.

I tried your algorithm with the number 755490975, which did not work.

It needs to be for (int i = 9; i > 0; i–) for it to work,.

You said it works for numbers shorter than 9 digits, but since it starts with a fixed divisor and digits, it can’t really work if the number is shorter.

I adjusted it to work also with a different amount than 9 numbers to support general 11-proof, not just for IBAN.

public static bool ValidateElevenProef(int value)

{

int total = 0;

int result = value;

int digits = value.ToString().Length;

int divisor = (int)Math.Pow(10, digits);

for (int i = digits; i > 0; i–)

total += i * Math.DivRem(result, divisor /= 10, out result);

int rest;

Math.DivRem(total, 11, out rest);

return result == rest;

}

It will also work with zero’s in front. When a string with a BSN, like “012345678”, is converted to an int it will get the int value 12345678. The algorithm can also validate nummbers shorter than nine digits.

]]>