
> 
> **Question:**
> 
> 
> which $n$ and $k$ satisfy $\frac{k^n-1}{2^n-1}\in\mathbb{N}$?
> 
> 
> 


The motivation for the question is a constraint on the cardinality of interpolation-constraints for the $2^n$ corners of a hypercube $[0,1]^n$:


* for one of the corners, e.g. $(1\_1,\,\dots,\,1\_n)$ there shall be exactly one constraint
* for all other corners the number of constraints shall be equal


$n=2; k=2m, k=6m\pm1$ are examples of valid solutions



Solutions to diophantine equation related to an interpolation problem on hypercubes
So we are trying to solve


$$k^n - 1 \equiv 0 \mod 2^n - 1 $$


I.E


$$ k^n \equiv 1 \mod 2^n - 1 $$


A class of solutions can be found by looking at the carmichael function. Namely


$$ k^{\lambda(2^n - 1)} \equiv 1 \mod 2^n - 1 $$


So we want that $\lambda(2^n - 1) = n$


Just going through this table: <https://en.wikipedia.org/wiki/Carmichael_function>


We see here that $\lambda(2^4 - 1) = 4$ so for any choice of $k>2$ coprime to 15 and $n=4$ this identity holds. So you can find some cool tricks like $$ \frac{11^4 - 1}{2^4 - 1} = 976$$


The next instance is $\lambda(2^6 - 1) = \lambda(63) = LCM(\lambda(3), \lambda(7)) = LCM(2,6) = 6 $


I wrote some code to find more instances, up to $n=50$ the only values are: 4, 6, 12. Found using the python 3.8 code below:



```
import math

prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,57,67,71,73,79,83,89,97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]


def lcm(a, b):
    return a*b // math.gcd(a, b)


def carm_prime_power(prime, power):
    if prime == 2 and power > 2:
        return 2**(power - 2)
    return (prime-1)*prime**(power - 1)

def carmichael(n):
    factor_list = {}
    for primes in prime_list:
        if n%primes == 0:
            factor_list[primes] = 1
            n = n//primes
            while n%primes == 0:
                factor_list[primes] += 1
                n = n//primes

    current_lcm = 1
    for primes in factor_list:
        current_lcm = lcm(current_lcm, carm_prime_power(primes, factor_list[primes]))

    return current_lcm



if __name__ == '__main__':
    n = 4
    while n < 50:
        if carmichael(2**n - 1) == n:
            print(n)
        n+=1
              

```

When $n \ne \lambda(2^n -1)$ it probably gets a lot more complex to characterize solutions. If you're interested I can write some code to search for such solutions.


