login
Number of integers, x, with n+1 digits, that have the property that there exists an integer k, with x <= k < 2*x, such that k/x = 1 + (x-10^n)/(10^n-1), i.e., the same digits appear in the denominator and in the recurring decimal.
2

%I #34 Jul 01 2017 13:06:12

%S 2,4,4,8,8,32,8,32,8,32,8,128,16,32,64,128,8,256,4,256,128,128,4,1024,

%T 64,128,32,512,64,8192,16,4096,64,128,256,2048,16,16,64,4096,32,16384,

%U 32,2048,512,128,8,8192,32,2048,256,1024,32,4096,512,8192,64,512,8

%N Number of integers, x, with n+1 digits, that have the property that there exists an integer k, with x <= k < 2*x, such that k/x = 1 + (x-10^n)/(10^n-1), i.e., the same digits appear in the denominator and in the recurring decimal.

%C This was suggested by generalizing an exam question which asked "Jack typed a whole number into his calculator and divided by 154. The result was 1.545454545. What was his number?"

%C It appears that a(n) is always a power of 2.

%e The number 154 has the property that there exists an integer, 238, for which

%e 238/154 = 1 + 54/99 = 1.545454545...

%e There are 4 three-digit values that give rise to a 2-digit recurring decimal:

%e 100/100.0 = 1.0000000000000000

%e 208/144.0 = 1.4444444444444444...

%e 238/154.0 = 1.5454545454545454...

%e 394/198.0 = 1.9898989898989898...

%e thus a(2) = 4.

%e For n=3, a(3) = 8:

%e 10000/10000.0 = 1.0000000000000000

%e 14938/12222.0 = 1.2222222222222222...

%e 16198/12727.0 = 1.2727272727272727...

%e 22348/14949.0 = 1.4949494949494949...

%e 22648/15049.0 = 1.5049504950495049...

%e 29830/17271.0 = 1.7271727172717271...

%e 31600/17776.0 = 1.7776777677767776...

%e 39994/19998.0 = 1.9998999899989998...

%t a[n_] := Length@ List@ ToRules@ Reduce[k/x == 1 + (x-10^n)/(10^n-1) && 10^n <= x < 10^(n+1) && x <= k < 2 x, {k, x}, Integers]; Array[a, 20] (* for n<60, _Giovanni Resta_, Jun 30 2017 *)

%o (Python 3)

%o from math import sqrt

%o def is_square(n):

%o root = int(sqrt(n))

%o return root*root == n

%o def find_sols(length):

%o count = 0

%o k=10**length

%o for n in range(k,4*k-2):

%o discr= (2*k-1)*(2*k-1) - 4*(k*(k-1)-(k-1)*n)

%o if is_square(discr):

%o count+=1

%o b=(-(2*k-1)+sqrt(discr))/2

%o print(n, k+b, n/(k+b))

%o return count

%o for i in range(8):

%o print(find_sols(i))

%Y Cf. A288781, A288782.

%K nonn,base

%O 1,1

%A _James Kilfiger_, Jun 14 2017

%E Definition corrected and a(11)-a(59) from _Giovanni Resta_, Jun 30 2017