9 explanation is no longer valid since i mangled the code
source | link

C - 148147 157148 157 163 166 172 200

C is the right tool for the job

s,t=10;ls;l(x){s+=(22>>x%t&122>>x%10&1)+(x/t%t==410%10==4)-!((x+89)/2%50);x&&l(x/100%t100%10);}main(x,v)int**v;{for(x=atoi(v[1]);x;x--)l(x),l(x/1000),s+=x>999;printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 6.

C - 148 157 163 166 172 200

C is the right tool for the job

s,t=10;l(x){s+=(22>>x%t&1)+(x/t%t==4)-!((x+89)/2%50);x&&l(x/100%t);}main(x,v)int**v;{for(x=atoi(v[1]);x;x--)l(x),l(x/1000),s+=x>999;printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 6.

C - 147 148 157 163 166 172 200

C is the right tool for the job

s;l(x){s+=(22>>x%10&1)+(x/10%10==4)-!((x+89)/2%50);x&&l(x/100%10);}main(x,v)int**v;{for(x=atoi(v[1]);x;x--)l(x),l(x/1000),s+=x>999;printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

8 added 23 characters in body
source | link

C - 157148 163157 163 166 172 200

C is the right tool for the job

#define ls,t=10;l(x){s+=(22>>x%t&1)+(x/t%t==4)+-!(22>>x(x+89)/'d'%t&12%50)-;x&&l(x/t%t==1&6>>x%t100%t)+
s,t=10;main;}main(x,v)int**v;{for(x=atoi(v[1]);x;x--)s+=ll(x),l(x/1000)(x>999);printf,s+=x>999;printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 6.

C - 157 163 166 172 200

#define l(x)(22>>x%t&1)+(x/t%t==4)+(22>>x/'d'%t&1)-(x/t%t==1&6>>x%t)+
s,t=10;main(x,v)int**v;{for(x=atoi(v[1]);x;x--)s+=l(x)l(x/1000)(x>999);printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 6.

C - 148 157 163 166 172 200

C is the right tool for the job

s,t=10;l(x){s+=(22>>x%t&1)+(x/t%t==4)-!((x+89)/2%50);x&&l(x/100%t);}main(x,v)int**v;{for(x=atoi(v[1]);x;x--)l(x),l(x/1000),s+=x>999;printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 6.

7 deleted 7 characters in body
source | link

C - 163157 166163 166 172 200

#define l(x)(x%'d'<20?16406>>x%20&1:(22>>x%10&122>>x%t&1)+(x/10%10==4)t%t==4)+(22>>x/'d'%10&1'd'%t&1)-(x/t%t==1&6>>x%t)+
s;mains,t=10;main(x,v)int**v;{for(x=atoi(v[1]);x;x--)s+=l(x)l(x/1000)(x>999);printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%10&122>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 164066.

C - 163 166 172 200

#define l(x)(x%'d'<20?16406>>x%20&1:(22>>x%10&1)+(x/10%10==4))+(22>>x/'d'%10&1)+
s;main(x,v)int**v;{for(x=atoi(v[1]);x;x--)s+=l(x)l(x/1000)(x>999);printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%10&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 16406.

C - 157 163 166 172 200

#define l(x)(22>>x%t&1)+(x/t%t==4)+(22>>x/'d'%t&1)-(x/t%t==1&6>>x%t)+
s,t=10;main(x,v)int**v;{for(x=atoi(v[1]);x;x--)s+=l(x)l(x/1000)(x>999);printf("%d",s);}

Original tests:

  • 1 -> 1
  • 10 -> 3
  • 101 -> 41

Tests by @PleaseStand :

  • 1020 -> 726
  • 21667 -> 40173
  • 120000 -> 262602
  • 999999 -> 2359000

Plus some of my own random tests: http://qp.mniip.com/p/cy

A little explanation:

The macro l(x) counts how many o's does it take to write x (<1000) in english.

22 is binary for 0000010110, so the expression (22>>x%t&1) is true if x%10 is either 4, 2, or 1.

A similar thing happens for 6.

6 added 3 characters in body
source | link
5 deleted 2 characters in body
source | link
4 deleted 1 characters in body; deleted 1 characters in body
source | link
3 screw warningless code
source | link
2 some explanation
source | link
1
source | link