3

Written in binary, 2015 looks like

$11111011111_2$

Find the smallest exponent $n > 0$ (if it exists) such that $2015^n$ ends in . . . $1111111111_2$ (ten ones) when written in binary.

Randin
  • 802
  • Interesting question :) Let me try something, give me 10 minutes – Joshua Lochner Jul 25 '16 at 19:51
  • 1
    Such a number will be congruent to $-1$ modulo $1024$. Does that help you at all, or is it just gibberish? – Arthur Jul 25 '16 at 19:51
  • 1
    An interesting question. Doug's answer settles it (+1 to both). I think that he could get away with looking at it modulo $64$. We have have $2015\equiv31$, so modulo $64$ its powers (starting from the zeroth) are congruent to $1,31,1,31,1,31,...$ ad infinitum. So ending in five ones is as high as it will go. If you test the binary representations of the powers you will see that $...000001$ and $...011111$ alternate. – Jyrki Lahtonen Jul 25 '16 at 20:20
  • @JyrkiLahtonen I tested the binary representations and guess what I got? ;) I posted the answer below – Joshua Lochner Jul 25 '16 at 20:24
  • So no such n exists out there. This was a problem off a contest at nearby university I tutor at . I will post the second part in a bit . ( Get it like a bit in a number expressed in binary !? ) – Randin Jul 25 '16 at 21:23

5 Answers5

2

the smallest number ending in 10 1's in binary is $2^{10} - 1$ find $k$ such that: $2015^k \equiv -1 \pmod{2^{10}}\\ 2015\equiv -33 \pmod{2^{10}}\\ (-32-1)^{32} = 1 + 32\cdot 32\cdots \equiv 1 \pmod{1024}\\ 2015^{32}\equiv 1 \pmod{1024}$

Check $k=16$,

$(-33)^{16}$ either equals $1, -1$ or something else. If it equals $1$, then we check $k=8$. If it equals $-1$, we are done. If it equals something else, then there will be no $k$ such that $2015^k\equiv -1 \pmod{ 1024}$.

$(-33)^{16} = 1 + 16\cdot 32 \equiv 513 \pmod{1024}$

There is no $k$ such that $2015^k$ ends in 10 1's

Shagnik
  • 3,613
Doug M
  • 57,877
  • 1
    Yeah I tried to find $k$ in python... My now very warm processor agrees with you (up to $k = 50000$). Thank you for saving its life. I think this would be a good problem for teaching the virtues of pencil and paper. – Shai Jul 25 '16 at 20:12
  • 2
    The approach above gives a suggestion as to how to script this, and after you get to k=32 and see that this is a cycle, you can abort the script. – Doug M Jul 25 '16 at 20:21
1

First of all, I would like to start off with saying that this is a very interesting question, and I would like to know what possibly caused you to think about this. This is a "brute-force" method, but it sometimes helps identify patterns.

I wrote a simple Java program to find the value of $2015^k$ Where k $\in \mathbb Z, k >0$, convert it to binary, and finally check if it ends in 10 1's...

Here is a pastebin link of the output in the format: $2015^k = ...1111111111_2$, computed up to 10000 terms. http://pastebin.com/nhd9k0ax


It simply just verifies what Doug M and angryavian posted above, and what is interesting, is that the last 6 binary terms alternate between: $$000001_2$$ and $$011111_2$$


If you would like to test this for numbers other than 2015, here is the Java code i used: http://pastebin.com/D0QA18xt

0

$2015 = (2^{11}-2^5-1)$. You want $n$ such that $2015^n = k2^{10}-1$ for some integer $k$. Working modulo $2^{10}$, this reduces to finding $n$ such that $(-2^5-1)^n \equiv -1 \mod 2^{10}$.

$$(-2^5-1)^n = (-1)^n \sum_{k=0}^n \binom{n}{k} 2^{5k} \equiv (-1)^n (n 2^5 + 1) \mod 2^{10}$$

When $n$ is odd we need $n2^5 + 1 \equiv 1 \mod 2^{10}$ which is impossible since odd $n$ implies $n2^5+1$ is even.

If $n$ is even, we want $n2^5+1 \equiv -1 \mod 2^{10}$. This reduces to $n2^4 \equiv -1 \mod 2^{10}$ which is impossible if $n$ is even.

Edit (since this was not clear): so, no such $n$ exists.

angryavian
  • 89,882
  • So what is your answer ? No such n ? – Randin Jul 25 '16 at 21:18
  • The answer is no such N everyone , and thank u for the valuable input on this problem . I'm glad it was enjoyed as much as when I discovered it and played :) – Randin Jul 26 '16 at 07:27
0

Generalizing this a bit.

Assume that the binary representation of an integer $n$ ends with $\ldots011\ldots1$, in other words there are $k$ ones at the end preceded by a $0$.

I claim that the $k+1$ last bits in the binary representation of $n^\ell$ behave as follows:

  • if $\ell$ is even we have $\ldots000\ldots01$ - a single one preceded by $k$ zeros, and
  • if $\ell$ is odd, then the pattern in $n^\ell$ is the same as it is with $n$ - $k$ ones preceded by a single zero.

Proof. The assumption says that $n\equiv 2^k-1\pmod{2^{k+1}}$. Let's calculate the powers modulo $2^{k+1}$. We see that $$ (2^k-1)^2=2^{2k}-2\cdot2^k+1=2^{2k}-2^{k+1}+1\equiv1\pmod{2^{k+1}}. $$ Therefore the residue class of $n$ is of order two modulo $2^{k+1}$. The claim follows from this.

Jyrki Lahtonen
  • 133,153
0

I am adding another answer and not adding on to my previous one, as they are different... As an "extension" to the question... what numbers will end with 10 1's in a row written in binary?

$a^k$ Where k $\in \mathbb Z, k >0$ and $a \in \mathbb Z, a >0$

The following general equation will return 10 1's in a row written in binary:

$((1024 *q)-1)^{2p-1}$ Where $q \in \mathbb Z, q >0$ and $p \in \mathbb Z, p >0$