# More efficient way to do this?

**URL:** <https://forum.kirupa.com/t/more-efficient-way-to-do-this/291433>\
**Category:** Uncategorized\
**Created:** [June 29, 2009, 8:07pm UTC](https://forum.kirupa.com/t/more-efficient-way-to-do-this/291433 "2009-06-29T20:07:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![igby](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/igby/32/2060_2.png) [@igby](https://forum.kirupa.com/u/igby)\
**Post date:** [June 29, 2009, 8:07pm UTC](https://forum.kirupa.com/t/more-efficient-way-to-do-this/291433/1 "2009-06-29T20:07:57Z")

</div>

Hello everyone, it seems like there’s probably a equation to make this more efficient, but I’m not the math whiz that many others may be.

Is there a simpler way to do this?:

```auto

switch (num) {
	case 1: pn = 0; break;
	case 2: pn = 2; break;
	case 3: pn = 4; break;
	case 4: pn = 6; break;
	case 5: pn = 8; break;
	case 6: pn = 10; break;
	case 7: pn = 12; break;
	case 8: pn = 14; break;
	case 9: pn = 16; break;
	case 10: pn = 18; break;
	case 11: pn = 20; break;
        //and it keeps going.....
}

```

In words what’s happening is that for every incremental number it goes to the next even number to process.

Any help would be greatly appreciated.
