Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
A Loumiotis <[email protected]> |

To |
[email protected] |

Subject |
st: Decomposing integers |

Date |
Thu, 19 Jul 2012 14:54:03 +0300 |

Hi, I have integer numbers of the following form: X=Sum[i=0/4](a[i]2^i)+(a[5]*2^5) where a[i] equals either 0 or 1 if i=0/4 and a[5] equals to any positive integer or 0. Given this construction I would like to find the unique combinations of a[i]'s that generated X. For example: X=22 was generated using a[1]=1, a[2]=1 and a[4]=1. So I would like to construct a local that contains the following list 0 1 1 0 1 0 X=65 was generated using a[0]=1 and a[5]=2 So in this case the local should contain 1 0 0 0 0 1 Is this possible? Thanks Antonis * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: Re: Decomposing integers***From:*A Loumiotis <[email protected]>

- Prev by Date:
**Re: st: q-q plots, theoretical distribution with values higher than the sample's cutoff point** - Next by Date:
**st: Re: Decomposing integers** - Previous by thread:
**st: Problem selecting data range within a variable** - Next by thread:
**st: Re: Decomposing integers** - Index(es):