Talk:Calkin-Wilf sequence

Revision as of 00:07, 29 December 2020 by rosettacode>Paddy3118 (i'th term?)

Off by one error?

The wikipedia entry starts the series with 1 not zero. The calculation of what term represents a rational also seems off by one. --Paddy3118 (talk) 22:29, 28 December 2020 (UTC)

Other calculations fail as 0 is never a term if calculating the i'th term from the run length encodings of i for example. Best to correct the task wording and adjust all examples I think. --Paddy3118 (talk) 23:37, 28 December 2020 (UTC)

The 123456789'th term of 83116 / 51639 applies to the wikipedia series where the "first" term is 1.

I get, using the wikipedia calcs:

for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
    print(i, ith_term(i))
0 1
1 1
2 1/2
3 2
4 1/3
5 3/2
6 2/3
7 3
8 1/4
9 4/3

zeroth, and first terms are both 1. Best to do as wikepedia does and have istart at 1 for the series I think? --Paddy3118 (talk) 00:07, 29 December 2020 (UTC)

Return to "Calkin-Wilf sequence" page.