A bit for fun, here is an expandable macro \checksum answering the initial query. Its definition uses no auxiliary macros. I provide two versions, the second one is perhaps more efficient. Anyhow, this is not very computationally intensive task.
\documentclass{article}
\usepackage{xintexpr}
% w index like in Python language
% [L] like a list in Python
% This syntax computes L only once, but each [L][w] to fetch item with
% index w "sees" the whole L
%
% there is annoying problem when the modulo 11 gives 0, then we
% we want final result to be 0 not 11 ...
% I solve it via 10 - (10+x) mod 11 trick to avoid an iterated mod 11 !
\newcommand\checksum[1]{%
\xinttheiiexpr
10 - (10 + subs(add([L][w]*(10-w), w = 0..8), L=\xintListWithSep{,}{#1})) 'mod' 11
\relax
}
% more efficient (probably), as here "i" is an individual digit of the input
% and @ at each step is <partial sum>, <decreasing weight>
\renewcommand\checksum[1]{%
\xinttheiiexpr
10 -
% @ is previous value. I.e. a two element "list".
(10 + [iter(0,10; ([@][0]+[@][1]*i,[@][1]-1), i=\xintListWithSep{,}{#1})][0]) 'mod' 11
\relax
}% we used 10 - (10 + x) mod 11 trick.
\begin{document}
% expandable macro!
\checksum{123456789}%10
\checksum{383480757}%5
\checksum{055215295}%1
\checksum{020113448}%9
\ifnum\checksum{123456789}=10 OK\else\ERROR\fi
\end{document}

And a no-package approach (as it has not been given in other answers)
\documentclass{article}
\makeatletter
\newcommand\checksum[1]{\check@sum #1}
\def\check@sum #1#2#3#4#5#6#7#8#9{%
\expandafter\check@@sum\the\numexpr 10*#1 + 9*#2 + 8*#3
+ 7*#4 + 6*#5 + 5*#6 + 4*#7 + 3*#8 + 2*#9.%
}
\def\check@@sum #1.{\the\numexpr 10 -
% this is 10 + #1 mod 11
(10 + #1 - 11*((#1+16)/11-1))}
\makeatother
\begin{document}
% expandable macro!
\checksum{123456789}%10
\checksum{383480757}%5
\checksum{055215295}%1
\checksum{020113448}%9
\ifnum\checksum{123456789}=10 OK\else\ERROR\fi
\end{document}
This is naturally much more efficient!
\number\\A` will give you the character number. – yannisl Dec 31 '11 at 13:45\\@tforis a better solution (from the LaTeX core). Will post a solution if nobody provides one in the meantime to-morrow. – yannisl Dec 31 '11 at 13:57\,\numberor@tfor`? I find no examples with google. I could write the convertion code in differnt programming languages but I'm lost in LaTeX.ean13isbnpackage\usepackage[ISBN=978-80-85955-35-4,SC0]{ean13isbn}and theisbnis EAN13 compatible as well. – yannisl Dec 31 '11 at 15:19