OFFSET
1,1
COMMENTS
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?"
It appears that a(n) is always a power of 2.
EXAMPLE
The number 154 has the property that there exists an integer, 238, for which
238/154 = 1 + 54/99 = 1.545454545...
There are 4 three-digit values that give rise to a 2-digit recurring decimal:
100/100.0 = 1.0000000000000000
208/144.0 = 1.4444444444444444...
238/154.0 = 1.5454545454545454...
394/198.0 = 1.9898989898989898...
thus a(2) = 4.
For n=3, a(3) = 8:
10000/10000.0 = 1.0000000000000000
14938/12222.0 = 1.2222222222222222...
16198/12727.0 = 1.2727272727272727...
22348/14949.0 = 1.4949494949494949...
22648/15049.0 = 1.5049504950495049...
29830/17271.0 = 1.7271727172717271...
31600/17776.0 = 1.7776777677767776...
39994/19998.0 = 1.9998999899989998...
MATHEMATICA
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 *)
PROG
(Python 3)
from math import sqrt
def is_square(n):
root = int(sqrt(n))
return root*root == n
def find_sols(length):
count = 0
k=10**length
for n in range(k, 4*k-2):
discr= (2*k-1)*(2*k-1) - 4*(k*(k-1)-(k-1)*n)
if is_square(discr):
count+=1
b=(-(2*k-1)+sqrt(discr))/2
print(n, k+b, n/(k+b))
return count
for i in range(8):
print(find_sols(i))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
James Kilfiger, Jun 14 2017
EXTENSIONS
Definition corrected and a(11)-a(59) from Giovanni Resta, Jun 30 2017
STATUS
approved