Quote:
Originally Posted by davar55
[Would someone doublecheck this value?]

it seems ok  I believe the following code is correct:
Code:
cnt0(n) = { local( cnt=0, m=divrem(n,10)); if( n<10, return(1));
/* Let n = 10 m[1] + m[2]. Count 0's in m[1] and multiply this by m[2]+1: This
* is the number of 0's in { 10 m[1],..., n } minus 1 (trailing 0 of 10 m[1]).
*/
n=m; while( n=divrem(n[1],10), cnt += !n[2] ); cnt *= (m[2] + 1);
/* now add the number of 0's occuring in last position in {0,...,10 m[1]}
* (this is equal to 1+m[1]) plus 10 * the number of 0's in { 1,...,m[1]1 }.
*/
cnt+1+m[1]+10*(cnt0( m[1]1 )1)
}