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.

A386406 Length of the preperiodic part of the decimal expansion of 1/n, including any leading zeros from the period.

This page as a plain text file.
%I A386406 #11 Jul 22 2025 21:13:24
%S A386406 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,
%T A386406 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,
%U A386406 1,1,3,1,1,2,2,1,1,1,4,1,1,1,2,1,1,1,3,1,1,1,3
%N A386406 Length of the preperiodic part of the decimal expansion of 1/n, including any leading zeros from the period.
%C A386406 See A114205.
%H A386406 <a href="/index/1#1overn">Index entries for sequences related to decimal expansion of 1/n</a>.
%F A386406 a(n) = p + (floor(log_10(1/f)) if f!=0), where p = A051628(n) and f = frac(10^p/n). - _Kevin Ryde_, Jul 22 2025
%e A386406 For n = 92, 1/n = 0.01(0869565217391304347826) = 0.010(8695652173913043478260), so the preperiodic part is "010" and has length a(92) = 3.
%t A386406 b[n_] := Block[{p,o}, {p,o} = RealDigits[1/n]; If[!IntegerQ[Last[p]], p = Join[Most[p],TakeWhile[Last[p],#==0&]]]; Length[p]-o];
%t A386406 Table[b[n], {n,2,100}]
%o A386406 (PARI) a(n) = my(pre = max(valuation(n,2),valuation(n,5)), r = 10^pre % n); pre + if(r,logint(n\r,10)); \\ _Kevin Ryde_, Jul 22 2025
%Y A386406 Cf. A051628, A114205, A114206.
%K A386406 nonn,base,easy
%O A386406 2,3
%A A386406 _Andrei Zabolotskii_, Jul 20 2025