OFFSET
0,1
COMMENTS
This is based on the following way of writing "8":
|--2--|
4.....1
|--8--|
64...16
|-32--|
The powers of 2 present in the LCD representation are added. For example: n=1 gives 1 + 16 = 17. According to the position of a digit in n, [1,2,4...] is replaced by [128,256...],[16384,32768...], etc.
PROG
(Scilab) function lcd: nb: final result ndc: number of digits u: interesting digit M(i, j): (j-1)th bit of (i-1) function [nb]=lcd(n); nb=0; M=[1 1 1 0 1 1 1; 1 0 0 0 1 0 0; 1 1 0 1 0 1 1; 1 1 0 1 1 1 0; 1 0 1 1 1 0 0; 0 1 1 1 1 1 0; 0 1 1 1 1 1 1; 1 1 0 0 1 0 0; 1 1 1 1 1 1 1; 1 1 1 1 1 1 0]; if n <> 0 then ndc=int(log10(n))+1, else ndc = 1, end; for cx = ndc:-1:1; u=int(n/(10^(cx-1))); n=n-u*(10^(cx-1)); for j=0:6; nb=nb+M(u+1, j+1)*2^(j+7*(ndc-cx)), end, end; endfunction
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Anonymous, Jun 08 2002
EXTENSIONS
More terms from Antonio G. Astudillo, Apr 21 2003
STATUS
approved