Using a geometric series to control many LEDs

If you split the value in two bytes, you can assign the first byte directly to PORTD 0...7 and the second to PORTB 4-5:

void set_outputs (int value)
  {
  PORTD = value&255;
  PORTB &= ~((value>>8)<<4);
  PORTB |= (value>>8)<<4;
  }

Connect LEDs to B5, B4, D7, D6, D5, D4, D3, D2, D1, D0 (for 1024 conditions from 0 to 1023 you need only 10 outputs).