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.

Showing 1-9 of 9 results.

A007733 Period of binary representation of 1/n. Also, multiplicative order of 2 modulo the odd part of n (= A000265(n)).

Original entry on oeis.org

1, 1, 2, 1, 4, 2, 3, 1, 6, 4, 10, 2, 12, 3, 4, 1, 8, 6, 18, 4, 6, 10, 11, 2, 20, 12, 18, 3, 28, 4, 5, 1, 10, 8, 12, 6, 36, 18, 12, 4, 20, 6, 14, 10, 12, 11, 23, 2, 21, 20, 8, 12, 52, 18, 20, 3, 18, 28, 58, 4, 60, 5, 6, 1, 12, 10, 66, 8, 22, 12, 35, 6, 9, 36, 20, 18, 30, 12, 39, 4, 54, 20, 82, 6
Offset: 1

Views

Author

N. J. A. Sloane, Hal Sampson (hals(AT)easynet.com)

Keywords

Comments

Also sequence of period lengths for n's when you do primality testing and calculate "2^k mod n" from k = 0..n. - Gottfried Helms, Oct 05 2000
Fractal sequence related to A002326: the even terms of this sequence are this sequence itself, constructed on A002326, whose terms are the odd terms of this sequence. - Alexandre Wajnberg, Apr 27 2005
It seems that a(n) is also the sum of the terms in one period of the base-2 MR-expansion of 1/n (see A136042 for definition). - John W. Layman, Jan 22 2009
Indices n such that a(n) divides n are listed in A068563. - Max Alekseyev, Aug 25 2013
a(n) is the smallest k such that x^n - 1 factors into n linear polynomials over GF(2^k). For example, a(12) = 2, and x^12 - 1 = (x - 1)^4*(x - w)^4*(x - (w + 1))^4 in GF(4), where w^2 + w + 1 = 0. - Jianing Song, Jan 20 2019

References

  • Simmons, G. J. The structure of the differentiation digraphs of binary sequences. Ars Combin. 35 (1993), A, 71-88, see Table 2. Math. Rev. 95f:05052.

Crossrefs

Cf. A136042. - John W. Layman, Jan 22 2009
Positions of records are A139099.

Programs

  • Haskell
    a007733 = a002326 . flip div 2 . subtract 1 . a000265
    -- Reinhard Zumkeller, Apr 13 2015
    
  • Mathematica
    f[n_] := MultiplicativeOrder[2, n/(2^IntegerExponent[n, 2])]; Array[f, 84] (* Robert G. Wilson v, Jun 10 2011 *)
  • PARI
    a(n) = znorder(Mod(2, n/2^valuation(n, 2))); \\ Michel Marcus, Apr 11 2015
    
  • Python
    from sympy.ntheory import n_order
    def A007733(n): return n_order(2,n>>(~n & n-1).bit_length()) # Chai Wah Wu, Jul 01 2022

Formula

a(n) = A002326((A000265(n) - 1)/2). - Max Alekseyev, Jun 11 2009

A115591 Primes p such that the multiplicative order of 2 modulo p is (p-1)/2.

Original entry on oeis.org

7, 17, 23, 41, 47, 71, 79, 97, 103, 137, 167, 191, 193, 199, 239, 263, 271, 311, 313, 359, 367, 383, 401, 409, 449, 463, 479, 487, 503, 521, 569, 599, 607, 647, 719, 743, 751, 761, 769, 809, 823, 839, 857, 863, 887, 929, 967, 977, 983, 991, 1009, 1031
Offset: 1

Views

Author

Don Reble, Mar 11 2006

Keywords

Comments

It appears that this is also the sequence of values of n for which the sum of terms of one period of the base-2 MR-expansion (see A136042) of 1/n equals (n-1)/2. An example appears in A155072 where one period of the base-2 MR-expansion of 1/17 is shown to be {5,1,1,1} with sum 8=(17-1)/2. - John W. Layman, Jan 19 2009
If p is a term of this sequence, then 2 is a quadratic residue module p, so p == 1, 7 (mod 8). - Jianing Song, Nov 01 2024

Crossrefs

Cf. A136042, A155072. - John W. Layman, Jan 19 2009

Programs

  • Magma
    [ p: p in PrimesUpTo(1031) | r eq 1 and Order(R!2) eq q where q,r is Quotrem(p,2) where R is ResidueClassRing(p) ]; // Klaus Brockhaus, Dec 02 2008
    
  • Mathematica
    fQ[n_] := 1 + 2 MultiplicativeOrder[2, n] == n; Select[ Prime@ Range@ 174, fQ]
  • PARI
    r=2;forprime(p=3,1500,z=(p-1)/znorder(Mod(r,p));if(z==2,print1(p,", "))); \\ Joerg Arndt, Jan 12 2011

A136043 Period-lengths of the base-2 MR-expansions of the reciprocals of the positive integers.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 1, 3, 2, 5, 1, 6, 1, 1, 1, 4, 3, 9, 2, 2, 5, 4, 1, 10, 6, 9, 1, 14, 1, 1, 1, 5, 4, 5, 3, 18, 9, 4, 2, 10, 2, 7, 5, 5, 4, 9, 1, 10, 10, 2, 6, 26, 9, 8, 1, 9, 14, 29, 1, 30, 1, 1, 1, 6, 5, 33, 4, 11, 5, 14, 3, 3, 18, 9, 9, 15, 4, 17, 2, 27, 10, 41, 2, 2, 7, 11, 5, 4, 5, 4, 4, 3, 9, 14
Offset: 1

Views

Author

John W. Layman, Dec 12 2007

Keywords

Comments

It appears that if p is a prime with 2 as a primitive root (A001122), then a(p)=(p-1)/2. This has been confirmed for primes up to 2000. See A136042 for the definition of the MR-expansion of a positive real number.

Examples

			In A136042 it is shown that the base-2 MR-expansion of 1/5 is {3,1,3,1,3,1,3,1,...}, with period-length 2, so a(5)=2.
		

Crossrefs

Formula

a(n) = 1 if n is a power of 2. It seems that otherwise a(n) = A119513(n). - Andrei Zabolotskii, Jul 28 2025

A155072 Positive integers n such that the base-2 MR-expansion of 1/n is periodic with period (n-1)/4.

Original entry on oeis.org

17, 41, 97, 137, 193, 313, 401, 409, 449, 521, 569, 761, 769, 809, 857, 929, 977, 1009, 1129, 1297, 1361, 1409, 1489, 1697, 1873, 1993, 2081, 2137, 2153, 2161, 2297, 2377, 2417, 2521, 2609, 2617, 2633, 2713, 2729, 2753, 2777, 2801, 2897, 3001
Offset: 1

Views

Author

John W. Layman, Jan 19 2009

Keywords

Comments

See A136042 for the definition of the MR-expansion of a positive real number.
It appears that all terms of this sequence are primes of the form 8n+1 (A007519).
Apparently a subsequence of A115591. - Mia Boudreau, Jun 17 2025

Examples

			Applying the definition of the base-2 MR-expansion to 1/17 gives 1/17 -> 2/17 -> 4/17 -> 8/17 -> 16/17 -> 32/17 -> 15/17 -> 30/17 -> 13/17 -> 26/17 -> 9/17 -> 18/17 -> 1/17 -> ..., which shows that the expansion begins {5,1,1,1,...} and has period 4=(17-1)/4.
		

Crossrefs

Programs

  • Mathematica
    a[p_] := 1 + Sum[2 Cos[2^n Pi/((2 p + 1) )], {n, 1, p}];
    Select[Range[500], Reduce[a[#]^2 == 2 # + 1, Integers] &];
    2 % + 1 (* Gerry Martens, May 01 2016 *)

Extensions

More terms from Mia Boudreau, Jun 17 2025

A225759 Primes p such that A179382((p+1)/2) = (p-1)/16.

Original entry on oeis.org

1217, 1249, 1553, 4049, 4273, 4481, 4993, 5297, 6449, 6481, 6689, 7121, 8081, 8609, 9137, 9281, 10337, 10369, 10433, 11617, 11633, 12577, 13441, 13633, 14321, 14753, 15569, 16417, 16433, 16673, 17137, 18257, 18433, 18481, 19793, 20113, 20353, 23057, 23857
Offset: 1

Views

Author

Lear Young, May 15 2013

Keywords

Comments

Let n be a natural number coprime to 10 and let c be the "cycle length of n" (defined below).
Conjecture 1: If n-1=2^x*c for some x<5, then n is prime. If x > 4, the relative density of primes in such numbers is 1.
Conjecture 2: If the period of the decimal expansion of 1/n is n-1 or a divisor of n-1, and if n-1=2^x*c or n+1=2^x*c for some x, then n is prime.
- Lear Young, with contributions from Peter Košinár, Giovanni Resta, Charles R Greathouse IV, May 22 2013
To define the "cycle length of n" (using n=73 as an example):
Step 1 : 73 + 1 = 74. Get the odd part of 74, which is 37
Step 2 : 73 + 37 = 110. Get the odd part of 110, which is 55
Step 3 : 73 + 55 = 128. Get the odd part of 128, which is 1
Continuing this operation (with 73+1) repeats the same steps as above. There are 3 steps in the cycle, so the cycle length of 73 is c=3. (same to A179382((73+1)/2)=3).
More for the "cycle length of n" see link and cross references.
The numbers in the sequence are the values of n in the above conjecture when c=4 in case (1).

Examples

			(1217-1)/16 = 76 = A179382(609).
		

Crossrefs

Analogs with different values of c: A001122 when c=1, A155072 when c=2, A001134 when c=3. A225890 has composite values.
Cf. A179382, A136042 (both sequences related to the way to get the "cycle length of n").

Programs

  • PARI
    oddres(n)=n>>valuation(n, 2)
    cyc(d)=my(k=1, t=1); while((t=oddres(t+d))>1, k++); k
    forstep(n=17,1e4,[32,16],if(cyc(n)==n>>4 && isprime(n), print1(n", ")))
    \\ Charles R Greathouse IV, May 15 2013

Extensions

Edited by Charles R Greathouse IV, Nov 11 2014

A226181 Primes p such that p-1 divided by the period of the binary expansion of 1/p equals 2^x for some nonnegative integer x.

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 23, 29, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 113, 131, 137, 139, 149, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 227, 233, 239, 257, 263, 269, 271, 281, 293, 311, 313, 317, 337, 347, 349
Offset: 1

Views

Author

Lear Young, May 30 2013

Keywords

Comments

Equivalently, p-1 divided by the period of the decimal expansion of 1/p equals 2^x for some nonnegative integer x. Composite numbers satisfying this condition are given in A243050. - Lear Young, May 30 2013
Let pi_1(x) and pi(x) be the numbers of primes of this sequence and all primes not exceeding x, respectively. Then, for x>=3, p_1(x)/pi(x) >= C_Artin = 0.37395581... Numerical results suggest that it is likely lim pi_1(x)/pi(x) = 2*C_Artin. - Peter J. C. Moses and Vladimir Shevelev, May 29 2014

Examples

			(41-1)/20 = 2. 20 is the period of the binary representation of 1/n, the odd part of 2 is 1.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[2, 100]], # == 2^IntegerExponent[#, 2] &[(# - 1)/MultiplicativeOrder[2, #]] &] (* Peter J. C. Moses, May 28 2014 *)
  • PARI
    is(n) = {
      m = valuation(n+1,2);
          k=(n+1)>>m;
          if(k!=1, for(i=0,(n-1)>>1,
            l=valuation(k+n,2);
            k=(k+n)>>l;
            m+=l;if(k==1,break)));
           ((n-1)/m)>>valuation((n-1)/m, 2)==1
           \\ m  equals znorder(Mod(2,n))
        }
    forstep(i=3,1e3,2,if(is(i),print1(i, ", ")))
    \\ Lear Young May 30 2013
    
  • PARI
    forstep(i=1,1e3,2,j = (i-1)/znorder(Mod(2,i));if(j>>valuation(j, 2)==1,print1(i, ", "))) \\ Lear Young May 31 2013

A136044 Base-2 MR-expansion of e = 2.71828... (the base of natural logarithms).

Original entry on oeis.org

0, 0, 1, 2, 1, 2, 1, 1, 1, 1, 1, 5, 2, 2, 4, 2, 1, 4, 2, 4, 2, 2, 1, 1, 2, 1, 2, 3, 2, 2, 3, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 4, 2, 2, 1, 4, 8, 3, 1, 1, 3, 1, 1, 1, 2, 3, 1, 1, 1, 3, 1, 1, 1, 4, 1, 1, 2, 1, 4, 2, 1, 1, 3, 1, 1, 4, 2, 1, 6, 1, 1, 1, 3, 1, 1, 4, 2, 1, 2, 3, 1, 2, 1, 2, 3, 2, 2, 1, 2, 2, 3, 1
Offset: 1

Views

Author

John W. Layman, Dec 12 2007

Keywords

Comments

See A136042 for the definition of the MR-expansion of a positive real number.

Examples

			See A136042 for an example of a base-2 MR-expansion.
		

Crossrefs

A158379 Period-lengths of the base-3 MR-expansions of the reciprocals of the positive integers.

Original entry on oeis.org

2, 1, 2, 2, 4, 1, 6, 1, 2, 4, 4, 2, 2, 6, 4, 3, 16, 1, 18, 2, 6, 3, 8, 1, 20, 1, 2, 6, 28, 4, 30, 7, 4, 16, 10, 2, 18, 18, 2, 2, 8, 6, 42, 8, 4, 11, 18, 3, 42, 20, 16, 4, 52, 1, 20, 3, 18, 28, 26, 2, 10, 30, 6, 15, 10, 3, 22, 12, 8, 8, 28, 1, 12, 18, 20, 18, 28, 1, 78, 1, 2, 8, 38, 6, 14, 42, 28
Offset: 1

Views

Author

John W. Layman, Mar 17 2009

Keywords

Comments

See A136042 for the definition of the MR-expansion.
It appears that if p is a prime with 3 as a primitive root (A001122), then the MR-expansion of 1/p is periodic with period p-1.
The period lengths of the base-2 MR-expansions of the reciprocals of the positive integers are given in A136043.

Examples

			The base-3 MR-expansion of 1/5 is {2,1,0,1,2,1,0,1,...} because 1/5->3/5->9/5->4/5->12/5->7/5->2/5->6/5->1/5->..., indicating that MR(1/5,3) begins {2,1,0,1,...} and has period 4. Thus a(5)=4.
		

Crossrefs

A226014 Primes p such that A179382((p+1)/2) = (p-1)/(2^x) for some x>0.

Original entry on oeis.org

3, 7, 11, 13, 17, 19, 29, 31, 37, 41, 53, 59, 61, 67, 83, 97, 101, 107, 113, 127, 131, 137, 139, 149, 163, 173, 179, 181, 193, 197, 211, 227, 257, 269, 281, 293, 313, 317, 347, 349, 353, 373, 379, 389, 401, 409, 419, 421, 443, 449, 461, 467, 491, 509, 521, 523, 541, 547, 557, 563, 569, 577, 587, 593, 613, 617, 619, 653, 659, 661, 677, 701, 709, 757, 761, 769, 773, 787, 797, 809, 821, 827, 829, 853, 857, 859, 877, 883, 907, 929, 941, 947, 977
Offset: 1

Views

Author

Lear Young, May 22 2013

Keywords

Comments

It is conjectured that:
Let n be an odd number and the period of 1/n is n-1 or a divisor of n-1. Call c=A179382((n+1)/2) the "cycle length of n". If c divides n-1 or n+1 = 2^x for some x>0, then n is prime. For details see link and Cf. - Lear Young, with contributions from Peter Košinár, Giovanni Resta, Charles R Greathouse IV, May 22 2013
The numbers in the sequence are the values of n in the above conjecture.

Examples

			929 : (929-1)/(2^2)=232=A179382((929+1)/2) and znorder(Mod(10,929))=464=(929-1)/2
		

Crossrefs

Cf. A179382, A136042 (both sequences related to the way to get the "cycle length of n").

Programs

  • PARI
    oddres(n)=n>>valuation(n, 2)
    cyc(d)=my(k=1, t=1); while((t=oddres(t+d))>1, k++); k
    forstep(n=3, 1e3, [4, 2, 2, 2], x=cyc(n);z=znorder(Mod(10, n));if((x==1 || (n%x==1 && oddres((n-1)/x)==1)) && (n%z==1 || n%z==0), print1(n", ")))
    \\ Charles R Greathouse IV, May 22 2013
Showing 1-9 of 9 results.