Magic prime fraction period

For a prime number p 1 = 3 p_1 = 3 and for square p 1 2 = 9 p_{1}^2 = 9 , the length of the period of the fraction L ( 1 3 ) = L ( 1 9 ) = 1 L(\frac{1}{3})=L(\frac{1}{9})=1 .

Find another minimal prime number p 2 > 3 p_2>3 for which L ( 1 p 2 ) = L ( 1 p 2 2 ) L(\frac{1}{p_2})=L(\frac{1}{p_{2}^2}) .

Give answer p 2 p_2 .

We exclude prime number equal 2 and prime number equal 5 that the period length there is equal to zero.

Problem from "Kvant" - Soviet and Russian popular scientific physics and mathematics journal for schoolchildren and students. There is the sequence A002371 .

Bonus. Open question - How many such numbers exist? It is very difficult to find p 3 , p 4 , . . . p_3, p_4, ... - for example p 3 > 56000000 p_3>56 000 000 .


The answer is 487.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Yuriy Kazakov
Jan 10, 2021

I also use python for solution. And I try to find p 3 p_3 - but it very big time. Here A045616 there is the result for p 3 p_3 .

K T
Jan 9, 2021

output:

per(1/2)=0; per(1/4)=0

per(1/3)=1; per(1/9)=1

per(1/5)=0; per(1/25)=0

per(1/487)=486; per(1/237169)=486

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def FillPrimes(upto):
    primes=[2]
    for n in range(3, upto):
        for p in primes:
            if p**2>n:
                primes.append(n)
                break
            if n%p==0:
                break
    return primes

# do a long division, keep track of repetitons 
def FractionExpansionPeriod(numer, denom, base, cutoff=0):
    quot = numer // denom
    numer = (numer - denom * quot) * base
    numers=[]
    while not (numer in numers):
        if numer==0:
            return 0
        if cutoff!=0 and len(numers)==cutoff:
            return -cutoff
        numers.append(numer)
        digit=numer//denom
        numer = (numer-denom*digit)*base
    return len(numers)

for p in FillPrimes(1000):
    per1=FractionExpansionPeriod(1,p,10)
    per2=FractionExpansionPeriod(1,p*p,10, per1)
    if per1==per2:
        print ("per(1/{})={}; per(1/{})={} ".format(p,per1,p*p,per2))

Thanks for attention.

Yuriy Kazakov - 5 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...