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-10 of 21 results. Next

A051626 Period of decimal representation of 1/n, or 0 if 1/n terminates.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 6, 0, 1, 0, 2, 1, 6, 6, 1, 0, 16, 1, 18, 0, 6, 2, 22, 1, 0, 6, 3, 6, 28, 1, 15, 0, 2, 16, 6, 1, 3, 18, 6, 0, 5, 6, 21, 2, 1, 22, 46, 1, 42, 0, 16, 6, 13, 3, 2, 6, 18, 28, 58, 1, 60, 15, 6, 0, 6, 2, 33, 16, 22, 6, 35, 1, 8, 3, 1, 18, 6, 6, 13, 0, 9, 5, 41, 6, 16, 21, 28, 2, 44, 1
Offset: 1

Views

Author

Keywords

Comments

Essentially same as A007732.
For any prime number p: if a(p) > 0, a(p) divides p-1. - David Spitzer, Jan 09 2017

Examples

			From _M. F. Hasler_, Dec 14 2015: (Start)
a(1) = a(2) = 0 because 1/1 = 1 and 1/2 = 0.5 have a finite decimal expansion.
a(3) = a(6) = a(9) = a(12) = 1 because 1/3 = 0.{3}*, 1/6 = 0.1{6}*, 1/9 = 0.{1}*, 1/12 = 0.08{3}* where the sequence of digits {...}* which repeats indefinitely is of length 1.
a(7) = 6 because 1/7 = 0.{142857}* with a period of 6.
a(17) = 16 because 1/17 = 0.{0588235294117647}* with a period of 16.
a(19) = 18 because 1/19 = 0.{052631578947368421}* with a period of 18. (End)
		

Crossrefs

Essentially same as A007732. Cf. A002371, A048595, A006883, A036275, A114205, A114206, A001913.

Programs

  • Maple
    A051626 := proc(n) local lpow,mpow ;
        if isA003592(n) then
           RETURN(0) ;
        else
           lpow:=1 ;
           while true do
              for mpow from lpow-1 to 0 by -1 do
                  if (10^lpow-10^mpow) mod n =0 then
                     RETURN(lpow-mpow) ;
                  fi ;
              od ;
              lpow := lpow+1 ;
           od ;
        fi ;
    end: # R. J. Mathar, Oct 19 2006
  • Mathematica
    r[x_]:=RealDigits[1/x]; w[x_]:=First[r[x]]; f[x_]:=First[w[x]]; l[x_]:=Last[w[x]]; z[x_]:=Last[r[x]];
    d[x_] := Which[IntegerQ[l[x]], 0, IntegerQ[f[x]]==False, Length[f[x]], True, Length[l[x]]]; Table[d[i], {i,1,90}] (* Hans Havermann, Oct 19 2006 *)
    fd[n_] := Block[{q},q = Last[First[RealDigits[1/n]]];If[IntegerQ[q], q = {}]; Length[q]];Table[fd[n], {n, 100}] (* Ray Chandler, Dec 06 2006 *)
    Table[Length[RealDigits[1/n][[1,-1]]],{n,90}] (* Harvey P. Dale, Jul 03 2011 *)
    a[n_] := If[ PowerMod[10, n, n] == 0, 0, MultiplicativeOrder[10, n/2^IntegerExponent[n, 2]/5^IntegerExponent[n, 5]]]; Array[a, 90] (* myself in A003592 and T. D. Noe in A007732 *) (* Robert G. Wilson v, Feb 20 2025 *)
  • PARI
    A051626(n)=if(1M. F. Hasler, Dec 14 2015
    
  • Python
    def A051626(n):
        if isA003592(n):
            return 0
        else:
            lpow=1
            while True:
                for mpow in range(lpow-1,-1,-1):
                    if (10**lpow-10**mpow) % n == 0:
                        return lpow-mpow
                lpow += 1 # Kenneth Myers, May 06 2016
    
  • Python
    from sympy import multiplicity, n_order
    def A051626(n): return 0 if (m:=(n>>(~n & n-1).bit_length())//5**multiplicity(5,n)) == 1 else n_order(10,m) # Chai Wah Wu, Aug 11 2022

Formula

a(n)=A132726(n,1); a(n)=a(A132740(n)); a(A132741(n))=a(A003592(n))=0. - Reinhard Zumkeller, Aug 27 2007

Extensions

More terms from James Sellers

A060284 Periodic part of decimal expansion of 1/n (leading 0's omitted).

Original entry on oeis.org

0, 0, 3, 0, 0, 6, 142857, 0, 1, 0, 9, 3, 76923, 714285, 6, 0, 588235294117647, 5, 52631578947368421, 0, 47619, 45, 434782608695652173913, 6, 0, 384615, 37, 571428, 344827586206896551724137931, 3, 32258064516129, 0, 3, 2941176470588235, 285714, 7, 27, 263157894736842105
Offset: 1

Views

Author

N. J. A. Sloane, Mar 30 2001

Keywords

Examples

			1/11 = .09090909..., so a(11) = 9.
		

Crossrefs

Extensions

More terms from Klaus Brockhaus and Jason Earls, Mar 30 2001
Offset corrected by R. J. Mathar, Jun 26 2010
B-file extended and a(168) and a(184) corrected by Ray Chandler, Jun 27 2017

A060283 Periodic part of decimal expansion of reciprocal of n-th prime (leading 0's moved to end).

Original entry on oeis.org

0, 3, 0, 142857, 90, 769230, 5882352941176470, 526315789473684210, 4347826086956521739130, 3448275862068965517241379310, 322580645161290, 270, 24390, 232558139534883720930, 2127659574468085106382978723404255319148936170
Offset: 1

Views

Author

N. J. A. Sloane, Mar 30 2001

Keywords

Examples

			1/11 = .09090909..., so a(5) = 90.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[FindTransientRepeat[RealDigits[1/p,10,100][[1]],2][[2]]],{p,Prime[Range[20]]}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 10 2021 *)
  • PARI
    a(n)=t=iferr(znorder(Mod(10,n)),E,0);d=(10^t-1)/n;s=t-#Str(d);if(s,d*10^s,d)
    forprime(i=1,1e2,print1(a(i)", ")) \\ Lear Young, Mar 01 2014

Formula

A060283 = A036275 o A000040, i.e., a(n) = A036275(A000040(n)). - M. F. Hasler, Dec 28 2015

Extensions

More terms from Klaus Brockhaus, Mar 30 2001

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

A178505 Decimal form of the period of 1/n for n such that gcd(n,10)=1. Leading zeros are suppressed.

Original entry on oeis.org

3, 142857, 1, 9, 76923, 588235294117647, 52631578947368421, 47619, 434782608695652173913, 37, 344827586206896551724137931, 32258064516129, 3, 27, 25641, 2439, 23255813953488372093
Offset: 1

Views

Author

Michel Lagneau, May 29 2010

Keywords

Comments

The numbers n are A045572, and the corresponding periods are A002329.

Examples

			3 is in the sequence because 1/3 = 0.3333...
142857 is in the sequence because 1/7 = 0.142857 142857 ...
1 is in the sequence because 1/9 = 0.1111....
		

Crossrefs

Programs

  • Maple
    with(numtheory): nn:= 100: T:=array(1..nn):k:=1: U:=array(1..nn):k:=1: for n from 2 to 200 do:x:=1/n:for p from 1 to 200 while(irem(10^p,n)<>1 or gcd(n,10)<> 1) do:od: if irem(10^p,n) = 1 and gcd(n,10) = 1 then y:=floor(x*10^p): T[k]:=y: U[k]:=n : k:=k+1:else fi:od:print(T):

Formula

a(n) = A060284(A045572(n+1)). [R. J. Mathar, Jun 26 2010]

Extensions

Name corrected by T. D. Noe, Jul 07 2010

A060251 a(n) = periodic part of decimal expansion of n/n-th prime (leading 0's moved to end).

Original entry on oeis.org

0, 6, 0, 571428, 45, 461538, 4117647058823529, 421052631578947368, 3913043478260869565217, 3448275862068965517241379310, 354838709677419, 324, 31707, 325581395348837209302, 3191489361702127659574468085106382978723404255
Offset: 1

Views

Author

Jason Earls, Mar 21 2001

Keywords

Examples

			a(4) = 4/7=.571428571428... so a(4)= 571428.
		

Crossrefs

Extensions

More terms from Klaus Brockhaus, Mar 31 2001
Description clarified by Ray Chandler, Jun 27 2017

A175555 Preperiodic part of the decimal expansion of 1/k as k runs through A065502.

Original entry on oeis.org

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

Views

Author

Michel Lagneau, Jun 29 2010

Keywords

Comments

Multiples of 2 or 5 generate a quotient with a preperiodic sequence of digits, for example 1/24 = 0.041666666..., and 41 is the decimal form of the preperiodic part.
Usually a(n) = A114205(A065502(n)), but the convention in A114205 that leading zeros in the periodic part are attached to the preperiodic part seems not to be used here. - R. J. Mathar, Jul 20 2012

Examples

			a(14)=4 is in the sequence because 1/25 = 0.040000... and 4 is the prefix.
208 is in the sequence because 1/48 = 2083333.... and 208 is the prefix.
		

Crossrefs

Cf. A036275.

Programs

  • Maple
    A175555 := proc(n)
            local k,s,al ;
            k := A065502(n) ;
            for s from 1 do
                    for al from 0 to s-1 do
                            if (10^s-10^al) mod k = 0 then
                                    return floor(10^al/k) ;
                            end if;
                    end do:
            end do:
    end proc: # R. J. Mathar, Jul 22 2012

A060282 Periodic part of decimal expansion of reciprocal of n-th prime (leading 0's omitted).

Original entry on oeis.org

0, 3, 0, 142857, 9, 76923, 588235294117647, 52631578947368421, 434782608695652173913, 344827586206896551724137931, 32258064516129, 27, 2439, 23255813953488372093, 212765957446808510638297872340425531914893617
Offset: 1

Views

Author

N. J. A. Sloane, Mar 30 2001

Keywords

Examples

			1/7 = 0.142857142..., so a(4) = 142857.
1/11 = 0.09090909..., so a(5) = 9.
		

Crossrefs

Programs

  • Mathematica
    primePer[1] = primePer[3] = 0; primePer[n_] := FromDigits[(d = RealDigits[1/Prime[n]])[[1, 1]]] * 10^d[[2]]; Array[ primePer, 15] (* Amiram Eldar, Apr 28 2020 *)
  • PARI
    f(n)=if(n<4,n==2,znorder(Mod(10, prime(n)))) \\ A002371
    for(n=1,100,print1(floor(10^f(n)/prime(n)),","))

Formula

a(n) = floor(10^A002371(n)/prime(n)).
a(n) = 0 if and only if n = 1 or 3, corresponding to the primes 2 and 5, which are factors of 10. - Alonso del Arte, Apr 03 2020
ceiling(log_10(a(n))) = prime(n) - 1 if prime(n) is a full reptend prime (A001913). - Alonso del Arte, Apr 14 2020

Extensions

More terms from Klaus Brockhaus, Mar 30 2001

A104013 First digit-cycle of binary expansion of 1/n. Any initial 0's are to be placed at end of cycle.

Original entry on oeis.org

0, 0, 10, 0, 1100, 10, 100, 0, 111000, 1100, 1011101000, 10, 100111011000, 100, 1000, 0, 11110000, 111000, 110101111001010000, 1100, 110000, 1011101000, 10110010000, 10, 10100011110101110000, 100111011000, 100101111011010000
Offset: 1

Views

Author

Bryan Jacobs (bryanjj(AT)gmail.com), Feb 25 2005

Keywords

Examples

			1/5 = 0.00110011001100... in binary, so a(5) = 1100.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := If[IntegerQ@ Log2@ n, 0, FromDigits[ RealDigits[1/n, 2][[1, 1]]]]; Array[f, 27] (* Robert G. Wilson v, Sep 01 2015 *)

A175562 The periodic part of the decimal expansion of 1/Fibonacci(n) with any initial zeros placed at the end of the cycle.

Original entry on oeis.org

0, 0, 0, 3, 0, 0, 769230, 476190, 2941176470588235, 18, 11235955056179775280898876404494382022471910, 4
Offset: 1

Views

Author

Michel Lagneau, Jul 02 2010

Keywords

Comments

A curiosity: the first six digits (with the first digit zero) of a(11): {0,1,1,2,3,5} are the first six Fibonacci numbers!
The next term of this sequence contains 232 digits (decimal form of the periodic part of 1/233 = 0.0042918454935622317596566523605150214...7210300).

Examples

			1/Fibonacci(7) = 1/13 = 0.0769230769230769230... and digit-cycle is 769230, so a(7)= 769230.
		

Crossrefs

Cf. A036275.

Programs

  • Mathematica
    fc[n_] := Block[{q}, q = Last[First[RealDigits[1/Fibonacci[n]]]]; If[IntegerQ[q], q = {}]; FromDigits[q]]; Table[fc[n], {n, 40}] (* see the Mathematica program in A036275 *)

Extensions

Name and comment corrected by T. D. Noe, Jul 06 2010
Showing 1-10 of 21 results. Next