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.

Previous Showing 11-20 of 47 results. Next

A007615 Primes with unique period length (the periods are given in A007498).

Original entry on oeis.org

3, 11, 37, 101, 333667, 9091, 9901, 909091, 1111111111111111111, 11111111111111111111111, 99990001, 999999000001, 909090909090909091, 900900900900990990990991, 9999999900000001, 909090909090909090909090909091, 900900900900900900900900900900990990990990990990990990990991
Offset: 1

Views

Author

Keywords

Comments

Additional terms are Phi(n,10)/gcd(n,Phi(n,10)) for the n in A007498, where Phi(n,10) is the n-th cyclotomic polynomial evaluated at 10.

Examples

			3 is the only prime p such that decimal expansion of 1/p has (nontrivial) period exactly 1.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Samuel Yates, Period Lengths of Exactly One or Two Prime Numbers, J. Rec. Math., 18 (1985), 22-24.

Crossrefs

Programs

  • Mathematica
    nmax = 50; periods = Reap[ Do[ p = Cyclotomic[n, 10] / GCD[n, Cyclotomic[n, 10]]; If[ PrimeQ[p], Sow[n]], {n, 1, nmax}]][[2, 1]]; Cyclotomic[#, 10] / GCD[#, Cyclotomic[#, 10]]& /@ periods // Prepend[#, 3]& (* Jean-François Alcover, Mar 28 2013 *)

Formula

a(n) = A061075(A007498(n)). - Max Alekseyev, Oct 16 2010
a(n) = A006530(A019328(A007498(n))). - Ray Chandler, May 10 2017

A007737 Period of repeating digits of 1/n in base 6.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 10, 1, 12, 2, 1, 1, 16, 1, 9, 1, 2, 10, 11, 1, 5, 12, 1, 2, 14, 1, 6, 1, 10, 16, 2, 1, 4, 9, 12, 1, 40, 2, 3, 10, 1, 11, 23, 1, 14, 5, 16, 12, 26, 1, 10, 2, 9, 14, 58, 1, 60, 6, 2, 1, 12, 10, 33, 16, 11, 2, 35, 1, 36, 4, 5, 9, 10, 12, 78, 1, 1, 40, 82, 2, 16, 3, 14, 10
Offset: 1

Views

Author

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

Keywords

Comments

Not multiplicative. Smallest counterexample: a(77)=10, but a(7) = 2 and a(11) = 10. - Mitch Harris, May 16 2005.

Crossrefs

Cf. A007733 (base 2), A007734 (3), A007735 (4), A007736 (5), A007738 (7), A007739 (8), A007740 (9), A007732 (10).

Programs

  • Mathematica
    DigitCycleLength[r_Rational, b_Integer?Positive] := MultiplicativeOrder[b, FixedPoint[ Quotient[#, GCD[#, b]] &, Denominator[r]]]; DigitCycleLength[1, b_Integer?Positive] = 1; Array[ DigitCycleLength[1/#, 6] &, 80] (* Robert G. Wilson v, Jun 10 2011 *)
    a[n_] := MultiplicativeOrder[6, n/Times @@ ({2, 3}^IntegerExponent[n, {2, 3}])]; Array[a, 100] (* Amiram Eldar, Aug 26 2024 *)
  • PARI
    a(n)=znorder(Mod(6, n/2^valuation(n, 2)/3^valuation(n, 3))); \\ Joerg Arndt, Dec 14 2014

Extensions

More terms from David W. Wilson

A066799 Square array read by antidiagonals of eventual period of powers of k mod n; period of repeating digits of 1/n in base k.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, 2, 1, 4, 2, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 2, 2, 1, 2, 3, 2, 6, 1, 1, 1, 1, 1, 4, 1, 6, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1, 2, 2, 3, 4, 10, 1, 1, 1, 2, 1, 2, 2, 1, 1, 6, 2, 5, 2, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 5, 2, 12
Offset: 1

Views

Author

Henry Bottomley, Dec 20 2001

Keywords

Comments

The determinant of the n X n matrix made from the northwest corner of this array is 0^(n-1). - Iain Fox, Mar 12 2018

Examples

			Rows start: 1,1,1,1,1,...; 1,1,1,1,1,...; 1,2,1,1,2,...; 1,1,2,1,1; 1,4,4,2,1,... T(3,2)=2 since the powers of 2 become 1,2,1,2,1,2,... mod 3 with period 2. T(4,2)=1 since the powers of 2 become 1,2,0,0,0,0,... mod 4 with eventual period 1.
Beginning of array:
+-----+--------------------------------------------------------------------
| n\k |  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  ...
+-----+--------------------------------------------------------------------
|  1  |  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1, ...
|  2  |  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1, ...
|  3  |  1,  2,  1,  1,  2,  1,  1,  2,  1,  1,  2,  1,  1,  2,  1,  1, ...
|  4  |  1,  1,  2,  1,  1,  1,  2,  1,  1,  1,  2,  1,  1,  1,  2,  1, ...
|  5  |  1,  4,  4,  2,  1,  1,  4,  4,  2,  1,  1,  4,  4,  2,  1,  1, ...
|  6  |  1,  2,  1,  1,  2,  1,  1,  2,  1,  1,  2,  1,  1,  2,  1,  1, ...
|  7  |  1,  3,  6,  3,  6,  2,  1,  1,  3,  6,  3,  6,  2,  1,  1,  3, ...
|  8  |  1,  1,  2,  1,  2,  1,  2,  1,  1,  1,  2,  1,  2,  1,  2,  1, ...
| ... |
		

Crossrefs

Columns are A000012, A007733, A007734, A007735, A007736, A007737, A007738, A007739, A007740, A007732. A002322 is the highest value in each row and the least common multiple of each row, while the number of distinct values in each row is A066800.

Programs

  • Mathematica
    t[n_, k_] := For[p = PowerMod[k, n, n]; m = n + 1, True, m++, If[PowerMod[k, m, n] == p, Return[m - n]]]; Flatten[Table[t[n - k + 1, k], {n, 1, 14}, {k, n, 1, -1}]] (* Jean-François Alcover, Jun 04 2012 *)
  • PARI
    a(n, k) = my(p=k^n%n); for(m=n+1, +oo, if(k^m%n==p, return(m-n))) \\ Iain Fox, Mar 12 2018

Formula

T(n, k) = T(n, k-n) if k > n.
T(n, n) = T(n, n+1) = 1.
T(n, n-1) = 2.

A114205 Write decimal expansion of 1/n as 0.PPP...PQQQ..., where QQQ... is the cyclic part. If the expansion does not terminate, any leading 0's in QQQ... are regarded as being at the end of the PPP...P part. Sequence gives PPP...P, right justified, with leading zeros omitted.

Original entry on oeis.org

5, 0, 25, 2, 1, 0, 125, 0, 1, 0, 8, 0, 0, 0, 625, 0, 0, 0, 5, 0, 0, 0, 41, 4, 0, 0, 3, 0, 0, 0, 3125, 0, 0, 0, 2, 0, 0, 0, 25, 0, 0, 0, 2, 0, 0, 0, 208, 0, 2, 0, 1, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 15625, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 1, 1, 0, 0, 0, 125, 0, 0, 0, 1, 0, 0, 0, 11, 0, 0, 0, 10
Offset: 2

Views

Author

N. J. A. Sloane, Oct 17 2006

Keywords

Comments

b(n) = A386406(n) gives the length of P (including leading zeros), c(n) = A036275(n) gives the smallest cycle in QQQ... (including terminating zeros) and d(n) = A051626(n) gives the length of that cycle.
Thus 1/n = 10^(-b(n)) * ( a(n) + c(n)/(10^d(n) - 1) ). When c(n)=d(n)=0, the fraction c(n)/(10^d(n) - 1), which is 0/0, evaluates (by definition) to 0.

Examples

			n .. expansion of 1/n .... a b c d
2 .50000000000000000000... 5 1 0 0
3 .33333333333333333333... 0 0 3 1
4 .25000000000000000000... 25 2 0 0
5 .20000000000000000000... 2 1 0 0
6 .16666666666666666667... 1 1 6 1
7 .14285714285714285714... 0 0 142857 6
8 .12500000000000000000... 125 3 0 0
9 .11111111111111111111... 0 0 1 1
10 .1000000000000000000... 1 1 0 0
11 .0909090909090909090... 0 1 90 2
12 .0833333333333333333... 8 2 3 1
13 .0769230769230769230... 0 1 769230 6
14 .0714285714285714285... 0 1 714285 6
15 .0666666666666666666... 0 1 6 1
16 .0625000000000000000... 625 4 0 0
(Start)
92 .0108695652173913043... 10  3 869...260 22
102 .009803921568627450... 0   2 980...450 16
416 .002403846153846153... 240 5 384615    6
4544 .00022007042253521... 2200 7 704...450 35
(End) - _Ruud H.G. van Tol_, Nov 20 2024
		

Crossrefs

Programs

  • Maple
    A114205 := proc(n) local sh,lpow,mpow,a,b ; lpow:=1 ; while true do for mpow from lpow-1 to 0 by -1 do if (10^lpow-10^mpow) mod n =0 then a := (10^lpow-10^mpow)/n ; sh := 10^(lpow-mpow)-1 ; b := a mod sh ; a := floor(a/sh) ; while b>0 and b*10 < sh+1 do a := 10*a ; b := 10*b ; end ; RETURN(a) ; fi ; od ; lpow := lpow+1 ; od ; end: for n from 2 to 600 do printf("%d %d ",n,A114205(n)) ; od ; # R. J. Mathar, Oct 19 2006
  • Mathematica
    fa[n_] := Block[{p},p = First[RealDigits[1/n]];If[ ! IntegerQ[Last[p]], p =  Join[Most[p],TakeWhile[Last[p],#==0&]]];FromDigits[p]];Table[fa[n], {n, 100}] (* Ray Chandler, Oct 18 2006 *)
  • PARI
    a(n)= my(s=max(valuation(n, 2), valuation(n, 5))); s||return(0); my([p, r]= divrem(10^s, n)); if(r&&(r=n\r)>9, s+=logint(r, 10)); 10^s\n; \\ Ruud H.G. van Tol, Nov 19 2024

Extensions

More terms from Ray Chandler and Hans Havermann, Oct 18 2006
I would also like to get programs that produce this and A114206, A036275, A051626 in Maple.
Edited by Andrei Zabolotskii, Jul 20 2025

A007735 Period of base 4 representation of 1/n.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 3, 1, 3, 2, 5, 1, 6, 3, 2, 1, 4, 3, 9, 2, 3, 5, 11, 1, 10, 6, 9, 3, 14, 2, 5, 1, 5, 4, 6, 3, 18, 9, 6, 2, 10, 3, 7, 5, 6, 11, 23, 1, 21, 10, 4, 6, 26, 9, 10, 3, 9, 14, 29, 2, 30, 5, 3, 1, 6, 5, 33, 4, 11, 6, 35, 3, 9, 18, 10, 9, 15, 6, 39, 2, 27, 10, 41, 3, 4, 7, 14, 5, 11, 6, 6, 11, 5
Offset: 1

Views

Author

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

Keywords

Crossrefs

Cf. A007733 (base 2), A007734 (3), A007736 (5), A007737 (6), A007738 (7), A007739 (8), A007740 (9), A007732 (10).

Programs

  • Mathematica
    DigitCycleLength[r_Rational, b_Integer?Positive] := MultiplicativeOrder[b, FixedPoint[ Quotient[#, GCD[#, b]] &, Denominator[r]]]; DigitCycleLength[1, b_Integer?Positive] = 1; Array[ DigitCycleLength[1/#, 4] &, 80] (* Robert G. Wilson v, Jun 10 2011 *)
    a[n_] := MultiplicativeOrder[4, n/2^IntegerExponent[n, 2]]; Array[a, 100] (* Amiram Eldar, Aug 26 2024 *)

Extensions

More terms from David W. Wilson

A007740 Period of repeating digits of 1/n in base 9.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 3, 1, 1, 2, 5, 1, 3, 3, 2, 2, 8, 1, 9, 2, 3, 5, 11, 1, 10, 3, 1, 3, 14, 2, 15, 4, 5, 8, 6, 1, 9, 9, 3, 2, 4, 3, 21, 5, 2, 11, 23, 2, 21, 10, 8, 3, 26, 1, 10, 3, 9, 14, 29, 2, 5, 15, 3, 8, 6, 5, 11, 8, 11, 6, 35, 1, 6, 9, 10, 9, 15, 3, 39, 2, 1, 4, 41, 3, 8, 21, 14, 5, 44, 2, 3, 11, 15, 23
Offset: 1

Views

Author

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

Keywords

Comments

Not multiplicative. Smallest counterexample a(5) = a(16) = 2, but a(80) = 2. - David W. Wilson, Jun 09 2005

Crossrefs

Cf. A007733 (base 2), A007734 (3), A007735 (4), A007736 (5), A007737 (6), A007738 (7), A007739 (8), A007732 (10).

Programs

  • Mathematica
    DigitCycleLength[r_Rational, b_Integer?Positive] := MultiplicativeOrder[b, FixedPoint[ Quotient[#, GCD[#, b]] &, Denominator[r]]]; DigitCycleLength[1, b_Integer?Positive] = 1; Array[ DigitCycleLength[1/#, 9] &, 80] (* Robert G. Wilson v, Jun 10 2011 *)
    a[n_] := MultiplicativeOrder[9, n/3^IntegerExponent[n, 3]]; Array[a, 100] (* Amiram Eldar, Aug 26 2024 *)

A121341 Number of decimal places before 1/n either recurs or terminates.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 6, 3, 1, 1, 2, 3, 6, 7, 2, 4, 16, 2, 18, 2, 6, 3, 22, 4, 2, 7, 3, 8, 28, 2, 15, 5, 2, 17, 7, 3, 3, 19, 6, 3, 5, 7, 21, 4, 2, 23, 46, 5, 42, 2, 16, 8, 13, 4, 3, 9, 18, 29, 58, 3, 60, 16, 6, 6, 7, 3, 33, 18, 22, 7, 35, 4, 8, 4, 3, 20, 6, 7, 13, 4, 9, 6, 41, 8, 17, 22, 28, 5, 44, 2, 6
Offset: 1

Views

Author

Anthony C Robin, Aug 29 2006

Keywords

Comments

In this sequence, the repeating decimals (e.g., 1/7) are treated differently from nonrepeating decimals (e.g., 1/5). If they are treated the same, then a(2)=2, a(4)=3, a(5)=2, a(8)=4, a(10)=2, ... and we obtain A054710. The two sequence differ only for n = 2^j * 5^k.

Examples

			1/592 = 0.0016891891891... starts with 4 decimals (0016, zeros counted) and has period 3 (digits 891) to yield a(592) = 4 + 3 = 7.
		

Crossrefs

A007732 is the length of the periods and serves as a lower bound. Cf. A061075.

Programs

  • Mathematica
    a[n_] := Max[IntegerExponent[n, 2], IntegerExponent[n, 5]] + Length[RealDigits[1/n][[1, -1]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jul 20 2022 *)

Formula

a(n) = A051628(n) + A051626(n). - Sean A. Irvine, Apr 13 2022

Extensions

More terms from T. D. Noe, Aug 30 2006
Additional comments from R. J. Mathar, Aug 30 2006

A007739 Period of repeating digits of 1/n in base 8.

Original entry on oeis.org

1, 1, 2, 1, 4, 2, 1, 1, 2, 4, 10, 2, 4, 1, 4, 1, 8, 2, 6, 4, 2, 10, 11, 2, 20, 4, 6, 1, 28, 4, 5, 1, 10, 8, 4, 2, 12, 6, 4, 4, 20, 2, 14, 10, 4, 11, 23, 2, 7, 20, 8, 4, 52, 6, 20, 1, 6, 28, 58, 4, 20, 5, 2, 1, 4, 10, 22, 8, 22, 4, 35, 2, 3, 12, 20, 6, 10, 4, 13, 4, 18, 20, 82, 2, 8, 14, 28, 10, 11, 4, 4
Offset: 1

Views

Author

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

Keywords

Crossrefs

Cf. A007733 (base 2), A007734 (3), A007735 (4), A007736 (5), A007737 (6), A007738 (7), A007740 (9), A007732 (10).

Programs

  • Mathematica
    DigitCycleLength[r_Rational, b_Integer?Positive] := MultiplicativeOrder[b, FixedPoint[ Quotient[#, GCD[#, b]] &, Denominator[r]]]; DigitCycleLength[1, b_Integer?Positive] = 1; Array[ DigitCycleLength[1/#, 8] &, 80] (* Robert G. Wilson v, Jun 10 2011 *)
    a[n_] := MultiplicativeOrder[8, n/2^IntegerExponent[n, 2]]; Array[a, 100] (* Amiram Eldar, Aug 26 2024 *)

Extensions

More terms from David W. Wilson

A135073 Primes for which the period of the reciprocal equals (p-1)/14.

Original entry on oeis.org

449, 1289, 3557, 4397, 4999, 5209, 6203, 6637, 7043, 8387, 10613, 11369, 13147, 13399, 14323, 16871, 18481, 19391, 20147, 20707, 26489, 28813, 29387, 29947, 30241, 32831, 32999, 33587, 36107, 37591, 38053, 39719, 40559, 41231, 41609
Offset: 1

Views

Author

Julien Peter Benney (jpbenney(AT)gmail.com), Feb 12 2008

Keywords

Comments

Also cyclic numbers of the fourteenth degree (or fourteenth order): the reciprocals of these numbers belong to one of fourteen different cycles. Each cycle has the (number minus 1)/14 digits.

Examples

			1289 has period of reciprocal 92, or (1289/1)/14.
		

Crossrefs

Programs

  • Maple
    A007732 := proc(n) local nred25 ; nred25 := n ; while nred25 mod 2 = 0 and nred25 > 1 do nred25 := nred25/2 ; od; while nred25 mod 5 = 0 and nred25 > 1 do nred25 := nred25/5 ; od; if nred25 = 1 then 1; else numtheory[order](10,nred25) ; fi ; end: for n from 1 to 22000 do p := ithprime(n) ; if 14*A007732(p) = p-1 then printf("%d,",p) ; fi ; od: # R. J. Mathar, Feb 21 2008
  • Mathematica
    Select[Prime[Range[4500]],Length[RealDigits[1/#][[1,1]]]==(#-1)/14&] (* Harvey P. Dale, Jun 22 2013 *)

Extensions

Corrected and extended by R. J. Mathar, Feb 21 2008

A048962 Table in which n-th row lists digits in periodic part of decimal expansion of 1/n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The length of row n is A007732(n). - T. D. Noe, May 14 2008
The convention is that the earliest period is displayed. - T. D. Noe, May 14 2008

Examples

			1/1=1. -> 0; 1/2=.5 ->0; 1/3=.3333... -> 3; 1/4=.25 -> 0; 1/5=.2 ->0; 1/6=.1666... -> 6; 1/7=.142857... -> 1 4 2 8 5 7; etc.
Triangle begins:
  0;
  0;
  3;
  0;
  0;
  6;
  1,4,2,8,5,7;
  0;
  1;
  0;
  0,9;
  3;
  0,7,6,9,2,3;
  7,1,4,2,8,5;
  6;
  0;
  ...
		

References

  • Conway and Guy, The Book of Numbers, p. 160

Crossrefs

Programs

  • Mathematica
    nmax = 50;
    row[n_] := Switch[FactorInteger[n], {{2, }} | {{5, }} | {{2, }, {5, }}, {0}, _, rd = RealDigits[N[1 + 1/n, 10 nmax]]; FindTransientRepeat[rd[[1]] // Rest, 2][[2]]];
    row /@ Range[nmax] // Flatten (* Jean-François Alcover, Dec 04 2019 *)
Previous Showing 11-20 of 47 results. Next