cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A352217 Smallest power of 2 that is one more than a multiple of 2n-1.

Original entry on oeis.org

2, 4, 16, 8, 64, 1024, 4096, 16, 256, 262144, 64, 2048, 1048576, 262144, 268435456, 32, 1024, 4096, 68719476736, 4096, 1048576, 16384, 4096, 8388608, 2097152, 256, 4503599627370496, 1048576, 262144, 288230376151711744, 1152921504606846976, 64, 4096
Offset: 1

Views

Author

J. Lowell, Mar 07 2022

Keywords

Comments

Every odd number is a divisor of a number of the form 2^n-1.

Examples

			a(5)=64 because 63 is the smallest number of the form 2^n-1 that's a multiple of 9.
		

Crossrefs

Programs

  • Maple
    a:= n-> 2^`if`(n=1, 1, numtheory[order](2, 2*n-1)):
    seq(a(n), n=1..50);  # Alois P. Heinz, Mar 07 2022
  • Mathematica
    Table[2^MultiplicativeOrder[2, 2*n - 1], {n, 1, 33}] (* Amiram Eldar, Mar 08 2022 *)
  • PARI
    a(n) = 1 << znorder(Mod(2,2*n-1)); \\ Kevin Ryde, Mar 07 2022
  • Python
    def a(n):
        if n == 1: return 2
        p, m = 2, 2*n-1
        while p <= m or p % m != 1: p *= 2
        return p
    print([a(n) for n in range(1, 34)]) # Michael S. Branicky, Mar 07 2022
    
  • Python
    from sympy import n_order
    def a(n): return 2**n_order(2, 2*n-1)
    print([a(n) for n in range(1, 34)]) # Michael S. Branicky, Mar 07 2022 after Alois P. Heinz
    

Formula

From Alois P. Heinz, Mar 07 2022: (Start)
a(n) = 2^A002326(n-1).
a(n) = 1 + A165781(n-1)*(2*n-1). (End)

Extensions

a(14) and beyond from Michael S. Branicky, Mar 07 2022