login
String of digits encountered in decimal expansion of successive ratios k/(k+1), treating only non-repeating expansions, with decimal point and leading and trailing zeros removed.
4

%I #58 Feb 25 2023 11:49:07

%S 5,75,8,875,9,9375,95,96,96875,975,98,984375,9875,99,992,9921875,

%T 99375,995,996,99609375,996875,9975,998,998046875,9984,9984375,99875,

%U 999,9990234375,9992,99921875,999375,9995,99951171875,9996,999609375,99968,9996875,99975

%N String of digits encountered in decimal expansion of successive ratios k/(k+1), treating only non-repeating expansions, with decimal point and leading and trailing zeros removed.

%C The sequence seems infinite and may be volatile in its extrema.

%C Conjecture: subsets of the sequence (as it fills out) will correspond to the odd integers by length.

%C Thus, there are 3 single-digit entries in range {1-9}, ending at 9; 5 two-digit entries in range {10-99} ending at 99; 7 three-digit entries in range {100-999} ending at 999, etc. The remainder set of course are all repeating decimals.

%C Denominators of the ratios that yield each term must be terms of A003592 (i.e., any integer m whose distinct prime factors p also divide 10, or m regular to 10), since only these denominators produce non-repeating decimal expansions. - _Michael De Vlieger_, Dec 30 2015

%D G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Sixth Edition, Oxford University Press, 2008, pages 141-144 (including Theorem 135).

%H Robert Israel, <a href="/A156703/b156703.txt">Table of n, a(n) for n = 1..6000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/DecimalExpansion.html">Decimal Expansion</a>.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RegularNumber.html">Regular Number</a>.

%H Wikimedia Commons, <a href="http://commons.wikimedia.org/wiki/File:OEIS_A156703.svg">Alternate plot</a>.

%F a(n) = 10^d*(k-1)/k where k = A003592(n+1) = 2^i*5^j and d=max(i,j). - _Robert Israel_, Dec 29 2015

%e 1/2 = 0.5 (non-repeating), which yields a(1) = 5.

%e 2/3 = 0.6666... (repeating, so does not yield a term in the sequence).

%e 3/4 = 0.75 (non-repeating), which yields a(2) = 75.

%e 4/5 = 0.8 (non-repeating), which yields a(3) = 8.

%p N:= 10^5: # to get terms for denominators <= N

%p B:= sort([seq(seq(2^i*5^j,i=0..ilog2(N/5^j)),j=0..ilog(N,5))]):

%p seq(10^max(padic:-ordp(n,2),padic:-ordp(n,5))*(n-1)/n, n=B[2..-1]); # _Robert Israel_, Dec 29 2015

%t FromDigits@ First@ # & /@ RealDigits@ Apply[#1/#2 &, Transpose@ {# - 1, #} &@ Select[Range@ 10000, AllTrue[First /@ FactorInteger@ #, MemberQ[{2, 5}, #] &] &], 1] (* _Michael De Vlieger_, Dec 30 2015, Version 10 *)

%t FromDigits@ First@# & /@ RealDigits@ Apply[#1/#2 &, Transpose@ {# - 1, #} &@ Select[Range@ 10000, First@ Union@ Map[MemberQ[{2, 5}, #] &, First /@ FactorInteger@ #] &], 1] (* _Michael De Vlieger_, Dec 30 2015, Version 6 *)

%o (PARI)

%o list(maxx)={my(N, vf=List()); maxx++;for(n=0, log(maxx)\log(5),

%o N=5^n; maxVal= 0;while(N<=maxx, if (N != 1, listput(vf, (N-1)/N));

%o N<<=1;)); vf = vecsort(Vec(vf));for (i=1,length(vf),

%o while(denominator(vf[i]) != 1, vf[i] *= 10););print(vf);}

%o \\ adapted from A158911 code, courtesy _Michel Marcus_, Dec 29 2015

%o (Python)

%o import string,copy

%o from decimal import *

%o getcontext().prec = 200

%o maxx=1000

%o n=1

%o maxLen=0

%o while n<maxx:

%o q=Decimal(n)/Decimal(n+1)

%o ratio=str(q)

%o myLen=len(ratio)

%o ratio.replace(" ","")

%o if len(ratio[2:])<15:

%o print(ratio[2:])

%o else:

%o strCopy=copy.copy(ratio[2:])

%o match=0

%o maxCnt=0

%o keyStr=' '

%o subLen=n

%o cap=len(ratio[2:])

%o for j5 in range(0,cap ):

%o for i5 in range(subLen,1,-1):

%o if i5<=j5:

%o break

%o subStr=strCopy[j5:i5]

%o if len(subStr)<1:

%o continue

%o match=strCopy.count(subStr)

%o z=match*len(subStr)

%o if z>maxCnt and match>1:

%o if len(subStr)==1 and z<subLen:

%o maxCnt=z

%o keyStr=copy.copy(subStr)

%o else:

%o maxCnt=z

%o keyStr=copy.copy(subStr)

%o if maxCnt>4:

%o pass

%o else:

%o print(ratio[2:])

%o getcontext().prec = max(2*subLen,200)

%o n+=1

%o # _Bill McEachen_, Dec 28 2015

%Y Cf. A003592, A158911. See comment at A158911.

%K easy,nonn,base

%O 1,1

%A _Bill McEachen_, Feb 13 2009