Rule for obtaining the decimal expansion of 1/17.

72 views
Skip to first unread message

Davide Rotondo

unread,
Aug 28, 2025, 2:58:16 AM (10 days ago) Aug 28
to SeqFan
Dear, today I noticed that it is possible to obtain the decimal expansion of 1/17 using the starting numbers 5, 8, 8, 2, 3, 5, 2, 8 and using the recursive rule that each value is given by the sum of the sixth preceding element plus the eighth preceding element: a(n) = a(n-6) + a(n-8), taking into account the appropriate carryovers when obtaining a two-digit number.

Example

5, 8, 8, 2, 3, 5, 2, 8, 13, 10, 11, 7, 5, 14, 6, 10, 5, ...
                             9   4     1             6       7

obtuse:

5, 8, 8, 2, 3, 5, 2, 8, 9, 4, 1, 1, 7, 6, 4, 7, 0, 5, ...

What do you think?
See you soon
Davide

Davide Rotondo

unread,
Aug 28, 2025, 3:03:25 AM (10 days ago) Aug 28
to seq...@googlegroups.com
th same method seems to be appropriate for 1/7 but with the rule a(n)=a(n-3)+a(n-4)

--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seqfan/5c966bcf-8500-44a3-be2d-8a610384c932n%40googlegroups.com.

Ted Dunning

unread,
Aug 28, 2025, 3:04:19 AM (10 days ago) Aug 28
to seq...@googlegroups.com

Something like this is likely to be true for most decimal expansions because the space of integer-coefficient linear expressions is so much larger than the space of digit sequences. The basic idea is that all that is needed on the surface is to encode a lookup table into recurrence. Whether you can find such a sparse formula for the lookup table is not clear.

Many of the recurrence relations won't as simple as the lovely one you found, of course.



--

sven-h...@gmx.de

unread,
Aug 28, 2025, 3:16:42 AM (10 days ago) Aug 28
to seq...@googlegroups.com

Hello together,

fun fact to the topic:

588**2 + 2353**2 = 5882353, where 588 and 2353 are the first digits in 1/17 (a bit rounded). There was  – long ago - an article in Journal of Recreational Mathematics about such effects of numbers n with n-1 repeating digits in 1/n. So this is no coincidence, but I did not find more…

Sven

--

Simon Plouffe

unread,
Aug 28, 2025, 3:22:36 AM (10 days ago) Aug 28
to seq...@googlegroups.com


Yes , and here is a trivial one even if it is surprising : 
 in most cases when p = prime and in base 10. 

 The first half of the digits is the complement to 9
of the second half. 
 
1 /7 = 0.142857 and 142 + 857 = 999 , the same 
with 1/17 = 0.0588235294117647... : 05882352 + 
94117647 = 99999999.

For any p, one can find a linear recurrence for
the digits , the problem is that if p = large number
it is not feasible in reasonable time-effort. 

The period for example of p = 2^19937 - 1 is 10^6002
digits long, ... good luck. 

Simon Plouffe

Ted Dunning

unread,
Aug 28, 2025, 3:43:14 AM (10 days ago) Aug 28
to seq...@googlegroups.com

1/13 = 0.076923 076923...

The six digits in this sequence follow a recurrence of the form

a_n = a_{n-1} + 9 a_{n-3} + a_{n-4}  (mod 10)

This comes from LU decomposition on the states of the recurrence. The system of equations is not independent so you have one degree of freedom in the result. I used that degree to set a coefficient to zero.

This can be done pretty easily with any repeating sequence of digits.

Stephen Lucas

unread,
Aug 28, 2025, 8:34:34 AM (10 days ago) Aug 28
to seq...@googlegroups.com
Greetings, Davide and all.
Since no-one has mentioned it yet, I thought I would suggest generating functions as the explanation of they this works. Since I only have a few minutes (I’ll return to this later) I’m going to remind us of the classic example of Fibonacci numbers. The generating function is s(z)=0+z+z^2+2x^3+3z^4+5z^5+… and combining shifted versions with itself we get s(z)=z/(1-z-z^2). Put z=1/10, so each Fibonacci number is put in a decimal digit, it sums to the fraction 10/89. 

So Davide’s lovely results can be verified by generating functions in reverse. Start with a linear recurrence relation and give it a generating function. Simple multiplying by powers of z and adding cancel the infinite sums, and the generating sum will always be a rational function, polynomial divided by polynomial. Let z=1/10, and you get a fraction where the digits are the recurrence relation coefficients — as long as the sequence doesn’t grow faster than 10^n. 

Going in reverse, it makes sense that every fraction can be found as a special case of a generating function for a recurrence relation with z=1/10. So every fraction can be related to a recurrence relation for its decimal digits. But finding that relationship is the challenge. Davide, how did you manage to find such an unusual recurrence relation for 1/17?

At some point years ago I wrote out the generating function for an arbitrary 2nd order linear recurrence relation, which gives some fractions, but obviously not all of them. This may inspire me to revisit that result and see if it is easily generalized…

Steve

Davide Rotondo

unread,
Aug 28, 2025, 9:15:12 AM (10 days ago) Aug 28
to seq...@googlegroups.com
For 1/19 the rule is a(n) = a(n-2) + a(n-4)

José Hdz. Stgo.

unread,
Aug 28, 2025, 10:13:57 AM (10 days ago) Aug 28
to seq...@googlegroups.com
Good morning, everyone!

I wanted to add that the fact mentioned by Professor Plouffe at the beginning of his message is known as "Midy's theorem" (cf. W. G. Leavitt, A theorem on repeating decimals. Amer. Math. Monthly, Vol. 74, No. 6, pp. 669-673).

Best regards,

José Hdz.

Davide Rotondo

unread,
Aug 28, 2025, 12:21:04 PM (10 days ago) Aug 28
to seq...@googlegroups.com
Hi Steve, I tried it by trial and error. I was inspired by the rule in https://oeis.org/A020806 a(n) = a(n-1) - a(n-3) + a(n-4) for n>3. I wanted to get an exact formula for every digit of 1/17. Only later did I realize I could get them by carrying them.


Davide Rotondo

unread,
Aug 29, 2025, 3:42:42 AM (9 days ago) Aug 29
to seq...@googlegroups.com
Rule for obtaining the decimal expansion of 1/23

Using the starting numbers 0, 4, 3, 4, 7, 8, 2, 6, 0, apply the rule a(n) = a(n-4) + a(n-9) and carry the appropriate numbers when you obtain a two-digit number.

Davide Rotondo

unread,
Aug 29, 2025, 4:21:47 AM (9 days ago) Aug 29
to seq...@googlegroups.com
decimal expansion of 1/29

Using the starting numbers 0,3,4,4,8,2,7,5,8,6,2,0,6  apply the rule a(n) = a(n-5) + a(n-13) and carry the appropriate numbers when you obtain a two-digit number.

Stephen Lucas

unread,
Aug 29, 2025, 10:40:31 AM (9 days ago) Aug 29
to seq...@googlegroups.com
Greetings, all.
I had time to cleanly write out an explanation of why Davide’s results are correct using generating functions, which might be of interest. Let’s use his result for 1/7 using a(n)=a(n-3)+a(n-4) as an example to keep the algebra straightforward.

Let s(x)=a(1)x+a(2)x^2+a(3)x^3+…, then by multiplying by powers of x, subtracting, and using the recurrence relation to zero out most of the coefficients, we get 
(1-x^3-x^4)s(x) = a(1)x+a(2)x^2+a(3)x^3+(a(4)-a(1))x^4,
Or
s(x) = (a(1)x+a(2)x^2+a(3)x^3+(a(4)-a(1))x^4) / (1-x^3-x^4).
If we let x=1/10, then the recurrence relation gives decimal digits of a fraction. Multiplying the top and bottom of the fraction by 10^4, we get
s(1/10) = (1000a(1)+100a(2)+10a(3)+(a(4)-a(1))) / (10000-10-1) where the denominator is 9989=7*1427.
If we choose a(1)=1, a(2)=4, a(3)=2, a(4)=8, voila, the numerator is 1427.

Other choices of the first 4 digits lead to other fractions, but most of them will have a large denominator. But if you start with digits 4,2,8,5, the numerator becomes 4281 and the fraction is 3/7 as expected.

It’s also worth noting that this approach will fail fairly quickly in 16 digit arithmetic when the recurrence relation coefficients grow too fast. In this example, solving the recurrence relation leads to constants to the power of n where the largest has norm about 1.2207. That grows fast, and for example the 150th term is 22151879081891. Since if any digit is greater than 10 we carry, it turns out that the first 150 terms give 137 correct decimal digits. Which explains why most of Davide’s examples found by brute force searching have such a large gap between related numbers, so that the recurrence relations don’t grow so fast.

I’ve looked at the more general case, but it is rather messy and not at all obvious how to search for a particular fraction given this way.

Finally, fascinating as this is, I’m not sure how we can turn it into a nice OEIS sequence. Perhaps the sequence of all fractions that can be represented by a given order recurrence relation in this way?

Steve

Allan Wechsler

unread,
Aug 29, 2025, 11:07:14 AM (9 days ago) Aug 29
to seq...@googlegroups.com
There are a variety of similar "power series made flesh" curiosities. One I recall is that 1/7 can also be generated with a(1) = 1, a(n+1) = 3a(n). This produces a lot of carrying right away, but it's still fun to watch: 0.1 + 0.03 = 0.13; then 0.13 + 0.009 = 0.139; then 0.139 + 0.0027 = 0.1417; then 0.1417 + 0.00081 = 0.14251; and so on.

When Steve Lucas asks which fractions can be represented "in this way", if "this way" just means "as a power series in 10^(-1) whose coefficients satisfy a linear recurrence", I am pretty sure the answer is "all of them".

The reverse game is fun too, where you take a linear recurrence and construct fractions whose decimal representation displays the sequence. You can make the "display windows" as wide as you want, to avoid having the entries bump into each other for a while. With two-digit display windows, some good examples are 1/98 (powers of two) and 1/9899 (left as an exercise to the reader to conjecture and prove).

--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.

Stephen Lucas

unread,
Aug 29, 2025, 12:32:07 PM (9 days ago) Aug 29
to seq...@googlegroups.com
I will certainly agree that it seems reasonable that every rational can be associated with a recurrence relation through the decimal digit trick. Allan’s 1/7 result is certainly correct, and yes there are a LOT of carries since coefficient grow as 3^n. I guess part of my interest with Davide’s original results is that the recurrence relation numbers grow sufficiently slowly that it is easy to see the digits without high precision arithmetic.

What I meant to say was: what if we bounded the order of the recurrence relation, what fractions are possible. The simplest would be first order, a(1)=d, a(n)=ca(n-1) with c, d positive integers. The generating function leads to s(1/10)=d/(10-c), so a nice small set of fractions with denominator 1 to 9. Even just second order is much messier, and finding all the fractions, particularly those that reduce to something small, requires an exhaustive search that I haven’t bothered with before.

And here is a final question I don’t know the answer to, that perhaps a reader of this group will know more about than me. I’m going to return to 10/89, which is associated with the Fibonacci numbers as decimal digits (just because I’ve looked at this before). Since it is periodic, the distribution of digits is definitely not normal. But, if you look at the digits of the Fibonacci numbers, that combine to 10/89, numerical tests with the first ten thousand or so suggest normality. Why? I looked at this years ago because the generating function for Catalan numbers involves a root. And so C(1/10) in this case leads to decimal digits that appear normal. I could never work out how to use this to move closer to proving that the digits of a root are normal, but this thread has brought up old memories.

Steve

Stephen Lucas

unread,
Sep 3, 2025, 4:30:55 PM (4 days ago) Sep 3
to seq...@googlegroups.com
And one more because I couldn’t help myself. The recurrence relation a(n)=b*a(n-7)+c*a(n-8) has generating function with x=1/10 equal to the fraction
s(1/10) = (10^7*a(1)+10^6*a(2)+10^5*a(3)+10^4*a(4)+10^3*a(5)+10^2*a(6)+10*a(7)+a(8)-b*a(1)) / (10^8-10b-c)
So whatever fraction you are interested in that looks like 1/q, find the multiple of q closest to 10^8 which gives you b and c, and the a(1) to a(8) are the denominator divided by q. So looking again at Davide’s fractions
* 1/7: 10^8-2=7*14285714, so b=0, c=2, a(1:8)=14285714, and the recurrence relation does indeed give digits of 1/7 after carries. Sequence grows like 1.09^n
* 1/17: 10^8-16=17*5882352, so b=1, c=6, a(1:8)=05882352, sequence grows like 1.28^n, a bit fast. Or, 10^8+1=17*5882353, so b=0, c=-1, a(1:8)=05882353. Be careful with the negative carries, but coefficients don’t grow at all, so I particularly like this one.
* 1/29: 10^8+4=29*3448276, so b=0, c=-4, a(1:8)=03448276, sequence grows like 1.189^n
* 1/23: 10^8-2=23*4347826, so b=0, c=2, a(1:8)=04347826. Interesting that the recurrence is exactly the same as that for 1/7, and after the fact obvious because (10^8-2)=2*7*23*310559

In conclusion, it turned out to be pretty easy to generate digits via this generating function pretty automatically. I chose a(n)=b*a(n-7)+c*a(n-8) so that the sequence doesn’t grow too fast so it is easier to build. But many other recurrence relations would be acceptable starting points. 

These kinds of recurrence relations could be generated automatically for a given order and fraction, and could then be added to those OEIS sequences that are decimal expansions of fractions. 

Steve

On Aug 29, 2025, at 4:21 AM, Davide Rotondo <david...@gmail.com> wrote:

Davide Rotondo

unread,
Sep 4, 2025, 2:58:19 AM (3 days ago) Sep 4
to seq...@googlegroups.com
Very beautiful!
Dear Steve, can you post a list of the rules of the first 100 primes?. I'm curious to see if I'm right that there are a lot of primes where one of the addends in the recursive rule is a Fibonacci number.

See you soon
Davide

You received this message because you are subscribed to a topic in the Google Groups "SeqFan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/seqfan/YtkJ-d2uWW0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to seqfan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seqfan/F82DC7D4-C938-4A46-A525-84BE1D318611%40gmail.com.

Stephen Lucas

unread,
Sep 5, 2025, 10:36:34 AM (2 days ago) Sep 5
to seq...@googlegroups.com
OK, this took a little coding, but I can now form the recurrence relation a(n)=c*a(n-k)+d*(n-k-1) and find the initial values a(1) to a(k+1) so that the terms in the recurrence relation are decimal digits for any 1/d. As requested by Davide, below is the list for k=7 (matching my previous results) and 1/p where p is prime. The table includes the prime, the initial digits, the c and d, then the expected rate of growth of terms (the smaller the better so fewer carries). I can do this for other k and experiment with “ideal” recurrence relations (when we decide what ideal means!). Guess I’m going to have to add these new results to all the sequences of decimal digits of fractions…

   n   starting    c    d    rate
   3   33333333   +0   +1   1.000
   5   20000000   +0   +0   0.000
   7   14285714   +0   +2   1.091
  11   09090909   +0   +1   1.000
  13   07692308   +0   -4   1.189
  17   05882353   +0   -1   1.000
  19   05263158   +0   -2   1.091
  23   04347826   +0   +2   1.091
  29   03448276   +0   -4   1.189
  31   03225806   +1   +4   1.230
  37   02702703   -1   -1   1.094
  41   02439024   +1   +6   1.282
  43   02325581   +1   +7   1.303
  47   02127660   -2   +0   1.104
  53   01886792   +2   +4   1.264
  59   01694915   +1   +5   1.258
  61   01639344   +1   +6   1.282
  67   01492537   +2   +1   1.162
  71   01408451   -2   -1   1.159
  73   01369863   +0   +1   1.000
  79   01265823   -1   -7   1.301
  83   01204819   +2   +3   1.237
  89   01123596   -4   -4   1.317
  97   01030928   -1   -6   1.280

Of interest is 1/73, where the period is 8, matching the order of the recurrence relation. 

Next, to pick a few fractions and experiment with recurrence relation order. Or change from 2 to 3 terms on the right hand side. Or find which fractions can be made using just coefficients one on the right hand side (mirroring Davide’s results).

Steve

Davide Rotondo

unread,
Sep 6, 2025, 3:45:08 AM (yesterday) Sep 6
to seq...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "SeqFan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seqfan+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages