Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I need an equation for these set of inputs and outputs. Y will equal anything below 0 or above 9 so modulo might be needed. Also if x<0 y=0 . It's probably going to be a little complex so any common mathematical symbol can be used if needed.

>| X | Y |
>| 0 | 0 |
>| 1 | 0 |
>| 2 | 0 |
>| 3 | 0 |
>| 4 | 1 |
>| 5 | 3 |
>| 6 | 6 |
>| 7 | 2 |
>| 8 | 5 |
>| 9 | 1 |
>| 10| 2 |
>| 11| 4 |
>| 12| 9 |
>| 13| 9 |
>| 14| 8 |
>| 15| 6 |
share|improve this question
    
What do you mean "equation"? Do you mean "polynomial equation"? –  rschwieb Oct 16 '12 at 13:18
add comment

1 Answer 1

OEIS finds: $$ y = \left\lfloor \frac{2^x \bmod 100}{10} \right\rfloor $$

share|improve this answer
    
or rather more obviously "Next-to-least significant digit of 2^n" –  Henry Oct 11 '12 at 22:38
    
Well thank you i was working on a program for counting the number of digits in a number if a user inputs 2^x. But since i would need to work with more than 2 bits could you explain to me how the function changes as you look for the 3rd to least significant bit,4th to least significant bit and so on? –  Dyrand Oct 12 '12 at 2:35
    
Dyrand, 3rd least significant bit would be $[(2^x\bmod1000)/100]$, 4th would be $[2^x\bmod10000)/1000]$, and so on. –  Gerry Myerson Oct 12 '12 at 5:12
2  
@Dyrand: Um, so you knew which sequence it was that you had your hand on, but held back that information so we'd have to guess and grope instead? I apologize for knowing how to use OEIS, then. –  Henning Makholm Oct 12 '12 at 11:12
    
Well thank you Gerry and Henning and sorry for not giving that information Henning. Also never heard of OEIS but it sure is helpful after checking it out. –  Dyrand Oct 12 '12 at 19:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.