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.

A285273 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.

Original entry on oeis.org

2, 4, 4, 8, 8, 32, 8, 32, 8, 32, 8, 128, 16, 32, 64, 128, 8, 256, 4, 256, 128, 128, 4, 1024, 64, 128, 32, 512, 64, 8192, 16, 4096, 64, 128, 256, 2048, 16, 16, 64, 4096, 32, 16384, 32, 2048, 512, 128, 8, 8192, 32, 2048, 256, 1024, 32, 4096, 512, 8192, 64, 512, 8
Offset: 1

Views

Author

James Kilfiger, Jun 14 2017

Keywords

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.

Examples

			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...
		

Crossrefs

Programs

  • 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 *)
  • Python
    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))

Extensions

Definition corrected and a(11)-a(59) from Giovanni Resta, Jun 30 2017