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.

A204987 Least k such that n divides 2^k - 2^j for some j satisfying 1 <= j < k.

Original entry on oeis.org

2, 2, 3, 3, 5, 3, 4, 4, 7, 5, 11, 4, 13, 4, 5, 5, 9, 7, 19, 6, 7, 11, 12, 5, 21, 13, 19, 5, 29, 5, 6, 6, 11, 9, 13, 8, 37, 19, 13, 7, 21, 7, 15, 12, 13, 12, 24, 6, 22, 21, 9, 14, 53, 19, 21, 6, 19, 29, 59, 6, 61, 6, 7, 7, 13, 11, 67, 10, 23, 13, 36, 9, 10, 37, 21, 20, 31, 13, 40, 8, 55, 21, 83, 8, 9, 15, 29, 13
Offset: 1

Views

Author

Clark Kimberling, Jan 21 2012

Keywords

Comments

See A204892 for a discussion and guide to related sequences.

Examples

			1 divides 2^2 - 2^1, so a(1)=2;
2 divides 2^2 - 2^1, so a(2)=2;
3 divides 2^3 - 2^1, so a(3)=3;
4 divides 2^3 - 2^2, so a(4)=3;
5 divides 2^5 - 2^1, so a(5)=5.
		

Crossrefs

Programs

  • Mathematica
    s[n_] := s[n] = 2^n; z1 = 1000; z2 = 50;
    Table[s[n], {n, 1, 30}]     (* A000079 *)
    u[m_] := u[m] = Flatten[Table[s[k] - s[j], {k, 2, z1}, {j, 1, k - 1}]][[m]]
    Table[u[m], {m, 1, z1}]     (* A204985 *)
    v[n_, h_] := v[n, h] = If[IntegerQ[u[h]/n], h, 0]
    w[n_] := w[n] = Table[v[n, h], {h, 1, z1}]
    d[n_] := d[n] = First[Delete[w[n], Position[w[n], 0]]]
    Table[d[n], {n, 1, z2}]     (* A204986 *)
    k[n_] := k[n] = Floor[(3 + Sqrt[8 d[n] - 1])/2]
    m[n_] := m[n] = Floor[(-1 + Sqrt[8 n - 7])/2]
    j[n_] := j[n] = d[n] - m[d[n]] (m[d[n]] + 1)/2
    Table[k[n], {n, 1, z2}]     (* A204987 *)
    Table[j[n], {n, 1, z2}]     (* A204988 *)
    Table[s[k[n]], {n, 1, z2}]  (* A204989 *)
    Table[s[j[n]], {n, 1, z2}]  (* A140670 ? *)
    Table[s[k[n]] - s[j[n]], {n, 1, z2}]     (* A204991 *)
    Table[(s[k[n]] - s[j[n]])/n, {n, 1, z2}] (* A204992 *)
    %%/2  (* A204990=(1/2)*A204991 *)
  • PARI
    A204987etA204988(n) = { my(k=2); while(1,for(j=1,k-1,if(!(((2^k)-(2^j))%n),return([k,j]))); k++); }; \\ (Computes also A204988 at the same time) - Antti Karttunen, Nov 19 2017
    
  • PARI
    a(n)={my(k=valuation(n,2)); max(k, 1) + znorder(Mod(2, n>>k))} \\ Andrew Howroyd, Aug 08 2018

Formula

a(n) = max(1, A007814(n)) + A007733(n). - Andrew Howroyd, Aug 08 2018

Extensions

More terms from Antti Karttunen, Nov 19 2017