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.

A114206 Length of the preperiodic part of the decimal expansion of 1/n, and also leading zeros from the period part if the preperiodic digits are all 0s (if any).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 17 2006

Keywords

Comments

Differs from A386406 at n = 92, 208, 248...

Examples

			For n = 11, 1/n = 0.(09), so the preperiodic part is empty and the initial 0 of the periodic part is included for length a(11) = 1.
For n = 92, 1/n = 0.01(0869565217391304347826) , so the preperiodic part is "01" and has length a(92) = 2 and the initial 0 in the periodic part is not included since that preperiodic part is not all 0s (unlike the way A386406(92) = 3 does include that inat periodic initial 0).
		

Crossrefs

Programs

  • Mathematica
    fb[n_] := Block[{rd, o, p},rd = RealDigits[1/n];o = Last[rd];p = First[rd];If[ ! IntegerQ[Last[p]], p = Most[p]];Length[p] - o];Table[fb[n], {n, 120}] (* Ray Chandler, Oct 18 2006 *)
    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]]; b[x_]:=Which[IntegerQ[l[x]], Length[w[x]]-1*z[x], IntegerQ[f[x]]==False, -1*z[x], True, Length[Drop[w[x],-1]]-1*z[x]]; (* Hans Havermann, Oct 18 2006 *)
    Table[b[i], {i,2,128}]
  • PARI
    a(n) = max(logint(n,10), max(valuation(n,2), valuation(n,5))); \\ Kevin Ryde, Jul 22 2025

Formula

a(n) = max(A004216(n), A051628(n)). - Kevin Ryde, Jul 22 2025

Extensions

More terms from Ray Chandler and Hans Havermann, Oct 18 2006
Edited by Andrei Zabolotskii and Kevin Ryde, Jul 20 2025