Wednesday, 29 January 2025

Another missing sequence

Today, looking again through OEIS, I noticed I could create the following sequence:

5, 67, 5, 13, 7, 17, 11, 37, 11, 31, 13, 29, 17, 61, 17, 37, 19, 41, 23, 127, 23, 139, 31, 53, 29, 109, 29, 61, 31, 71, 97, 199, 37, 73, 37, 83, 41, 157, 41, 167, 43, 89, 47, 181, 47, 97, 151, 101, 53, 307, 53, 109, 61, 113, 59, 229, 59, 127, 61, 131, ...,

Tabulated, this sequence is:
n k Representation
2 5 101two
3 67 2111three
4 5 101four
5 13 23five
6 7 11six
7 17 23seven
8 11 13eight
9 37 41nine
10 11 11
11 31 2911
12 13 1112
13 29 2313
14 17 1314
15 61 4115
16 17 1116
17 37 2317
18 19 1118
19 41 2319
20 23 1320
21 127 6121
22 23 1122
23 139 6123
24 31 1724
25 53 2325
26 29 1326
27 109 4127
28 29 1128
29 61 2329
30 31 1130
31 71 2931
32 97 3132
33 199 6133
34 37 1337
35 73 2335
36 37 1136
37 83 2937
38 41 1338
39 157 4139
40 41 1140
41 167 4341
42 43 1142
43 89 2343
44 47 1344
45 181 4145
46 47 1146
47 97 2347
48 151 3748
49 101 2349
50 53 1350
51 307 6151
52 53 1152
53 109 2353
54 61 1754
55 113 2355
56 59 1356
57 229 4157
58 59 1158
59 127 2959
60 61 1160
61 131 2961
Each member of the sequence [the second column] is the smallest prime greater than n whose base-n expansion is also a valid decimal expansion of a prime.

Without the requirement to be bigger than the base, every member for n greater than 2 would be 2 itself.

Although it is normally difficult to write bases larger than 35 (if it be assumed O and 0 are not distinct as I have always done) and it is not easy to establish a standard convention for them, the numbers in the above table can be written easily without differences of convention. This is because the decimal digits are a subset of the digits for any larger base, so that a basic decimal representation is also possible for any larger base, and this is the objective behind this sequence.

Looking at the list, one notices a clear pattern by which odd bases give larger k than even bases — the opposite of the pattern noted for smallest weakly prime number at OEIS A186995. However, the reasoning is the same as that for A186995 — that in an odd base there exist more possibilities for the last digit of a prime, although certain digit combinations which yield decimal expansions of primes cannot do so in many odd bases.

Friday, 24 January 2025

Comparative base maximum periods

(* indicates the expansion of the reciprocal terminates)
b 2-1 3-1 4-1 5-1 6-1 7-1 8-1 9-1 10-1 11-1 12-1 13-1 14-1 15-1 16-1 17-1 18-1 19-1 20-1 21-1 22-1 Max. #>4 #>5 #>6 #>8 #>9 #>10
2 * 2 * 4 2 3 * 6 4 10 2 12 3 4 * 8 6 18 4 6 10 18 8 8 5 4 4 2
3 1 * 2 4 1 6 2 * 4 5 2 3 6 4 4 16 1 18 4 6 5 18 7 5 2 2 2 2
4 * 1 * 2 1 3 * 3 2 5 1 6 3 2 * 4 3 9 2 3 5 9 4 2 1 1 0 0
5 1 2 1 * 2 6 2 6 1 5 2 4 6 2 4 16 6 9 1 6 5 16 9 7 2 2 1 1
6 * * * 1 * 2 * * 1 10 * 12 2 1 * 16 * 9 1 2 10 16 5 5 5 5 4 2
7 1 1 2 4 1 * 2 3 4 10 2 12 1 4 2 16 3 3 4 1 10 16 4 4 4 4 4 2
8 * 2 * 4 2 1 * 2 4 10 2 4 1 4 * 8 2 6 4 2 10 10 4 4 3 2 2 0
9 1 * 1 2 1 3 1 * 2 5 1 3 3 2 2 8 1 9 2 3 5 9 4 2 2 1 0 0
10 * 1 * * 1 6 * 1 * 2 1 6 6 1 * 16 1 18 * 6 2 18 6 6 2 2 2 2
11 1 2 2 1 2 3 2 6 1 * 2 12 3 2 4 16 6 3 2 6 1 16 5 5 2 2 2 2
12 * * * 4 * 6 * * 4 1 * 2 6 4 * 16 * 6 4 6 1 16 5 5 1 1 1 1
13 1 1 1 4 1 2 2 3 4 10 1 * 2 4 4 4 3 18 4 2 10 18 3 3 3 3 3 1
14 * 2 * 2 2 * * 6 2 5 2 1 * 2 * 16 6 18 2 2 5 18 6 4 2 2 2 2
15 1 * 2 * 1 1 2 * 1 5 2 12 1 * 2 8 1 18 2 1 5 18 5 3 3 2 2 2
16 * 1 * 1 1 3 * 3 1 5 1 3 3 1 * 2 3 9 1 3 5 9 3 1 1 1 0 0
17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6 3 3 3 1
53 1 2 1 4 2 3 2 2 4 5 2 1 3 4 4 8 2 18 4 6 5 18 5 3 2 1 1 1
54 * * * 2 * 6 * * 2 2 * 12 6 2 * 16 * 9 2 6 2 16 6 6 3 3 2 2
55 1 1 2 * 1 2 2 1 1 * 1 3 2 1 2 4 1 9 2 2 1 9 1 1 1 1 0 0
56 * 2 * 1 2 * * 6 1 1 2 6 * 2 * 16 6 18 1 2 1 18 5 5 2 2 2 2
57 1 * 1 4 1 1 1 * 4 10 1 12 1 4 2 16 1 * 4 1 10 16 4 4 4 4 4 2
58 * 1 * 4 1 3 * 3 4 5 1 12 3 4 * 16 1 9 4 3 5 16 5 3 3 3 2 2
59 1 2 2 2 2 6 2 6 2 5 2 12 6 2 4 8 6 18 2 6 5 18 10 8 3 2 2 2
60 * * * * * 3 * * * 5 * 4 3 * * 8 * 18 * 3 5 18 4 2 2 1 1 1
61 1 1 1 1 1 6 2 3 1 10 1 3 6 1 4 16 3 9 1 6 10 16 7 7 4 4 3 1
62 * 2 * 4 2 2 * 2 4 10 2 6 2 4 * 16 2 9 4 2 10 16 5 5 4 4 3 1
63 1 * 2 4 1 * 2 * 4 10 2 12 1 4 2 16 1 18 4 * 10 18 5 5 5 5 5 3
In recent years I have had considerable interest in comparing various bases regarding certain features of representations of various fractions. Unless the denominator contains no prime factor which does not divide the base (in which case the fraction will terminate) the representation of a fraction in any base will be recurring with a period equal to the smallest repunit divisible by the denominator in question.

A fraction with denominator n can have a period of at most n-1 regardless of base, and a period of n-1 is possible only for prime numbers. Such prime numbers are referred to as full period primes or full repetend primes, and except for perfect powers they generally constitute about three-eighths of all primes.

In the table above, I have attempted to compare the periods of reciprocals of all numbers from 2 to 22 in all bases from 2 to 63 — although for bases beyond 35 it is very difficult to write them out in easily understood notation. The aim is to see:
  1. what base has the shortest maximum period for these reciprocals
  2. what bases have the highest and lowest frequencies of long periods
    • usually, a terminating expansion is taken as having period zero — effectively the shortest possible period
In the table above, I have compared:
  1. the longest period in each base for the reciprocals of any number from 2 to 22
  2. the number of numbers in that range with periods longer than 4, 5, 6, 8, 9 or 10
    • no number smaller than 29 can have period 7 in any base, so the column “>7” was omitted after I experimented

Results:

The table above shows that for bases form 2 to 63:
  • the shortest maximum period of reciprocal up to 22 is 6 for base 38, followed by 8 for bases 26 and 49 (all shaded dark green)
  • the shortest maximum period of reciprocal up to 18 is 4 for bases 21, 34, and 55 (shaded light green)
    • it is interesting to note that 21+34 = 55, and one wonders if there is a pattern involved?
    • base 60, with all reciprocals up to 18 having periods of 5 or shorter, has also been shaded light green
  • the most reciprocals up to 22 with periods longer than 4 is ten, for base 59
  • the fewest reciprocals up to 22 with periods longer than 4 is one [in all cases the reciprocal of 19] for bases 21, 34 and 55
To more accurately consider the effect of base structure on period of reciprocal, I have compared bases by dividing them into five groups based upon factorisation:
  1. prime bases
  2. semiprime bases
  3. nonsquare semiprime bases
    1. I did this because square bases do not normally have any full period primes at all
    2. thus, their maximum possible period is only half that of nonsquare bases
  4. bases other than those in 1) or 2)
  5. group 4) excluding square numbers
Comparative Results for Different Categories of Bases b
Maximum #>4 #>5 #>6 #>8 #>9 #>10
Prime 15.41176 6.352941 5.529412 2.882353 2.588235 2.235294 1.294118
Semiprime 14 4.045455 3.227273 2.272727 2.045455 1.681818 1.045455
Squarefree semiprime 15.16667 4.055556 3.5 2.444444 2.333333 2.055556 1.277778
Others 14.61905 4.761905 4.095238 2.428571 2.190476 1.952381 1.190476
Other nonsquare 15.21053 4.842105 4.315789 2.684211 2.473684 2.263158 1.315789
What appears to be the case is the prime bases have the greatest number of long periods, but semiprime bases on the whole have marginally fewer than bases with three or more factors. The difference between the three groups, though, is not large — indeed the prime base 47 is the smallest base where all reciprocals up to 24 have periods of nine or shorter. The one exception is that prime bases appear to have substantially fewer denominators with periods of 4 or shorter.

Further research could allow for investigation into questions like:
  • how hard is it to find a base yielding consistently short periods for denominators of increasing size?
    • how many such bases are there?
    • can one calculate the smallest base for which all fractions up to have periods of p or shorter with n and p arbitrary?
  • what are the trends in frequency of denominators with short periods relative to size and number of factors in the base b as bases get bigger than studied here?