0
$\begingroup$

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 |
  • 0
    What do you mean "equation"? Do you mean "polynomial equation"?2012-10-16

1 Answers 1

3

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

  • 0
    or rather more obviously "Next-to-least significant digit of 2^n"2012-10-11
  • 0
    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?2012-10-12
  • 0
    Dyrand, 3rd least significant bit would be $[(2^x\bmod1000)/100]$, 4th would be $[2^x\bmod10000)/1000]$, and so on.2012-10-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.2012-10-12
  • 0
    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.2012-10-12