ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
Let f(a) be a function defined over the natural numbers.
2
3
Suppose there exists one or more solutions "n" such that f(a) = n for many different a. Let's call the solution set A
4
For such n, suppose we are interested in finding consecutive numbers x through x + k (k > 0) such that f(x+i) = n for every 0 <= i <= k
5
6
Let L = k + 1, the range length
7
Let the solutions x be partitioned into number of groups based on the range length. The set of groups is given by: product (p(i) ^ e(j) for j = 0 to ceiling (log(l)/log(p(i))) where each p is prime
8
We partition the solutions into these groups so that we can later efficiently iterate over them (for the sake finding valid solutions in a consecutive range.
9
Primes p > l are not in consideration in this exercise. This is a crude "first-pass" measure just to see what common solutions over a consecutive range would have to obey.
10
11
Background: This general question came about when I unsuccessfully tried to tackle the problem posed here: https://www.primepuzzles.net/puzzles/puzz_670.htm
12
13
Task: Compute S(L), the exact number of sets for each L >=1. Solutions have been computed through L = 19 using a C++ program. Currently, it stores the sets in an "unordered map". The code takes advantage of
14
symmetry to avoid obvious redundancies but this quasi-brute force approach in the code requires progressively larger amounts of memory.. Ideally, a formula could be determined.
15
Short of that, a program / heuristic that avoided storing large numbers of sets would be terrific.
16
17
C++ Source:
https://github.com/grandpascorpion/miscMath
18
19
20
L = 2
21
22
We only need to partition A into A(2) and A(1). In this context, A(2) means its members are divisible by any positive power of 2 (even) and A(1) means its members are all 2-unsmooth or odd.
23
We only have two sensible combinations for solutions to f(x) = f(x+1) = n
24
25
xx+1
26
Member of A(2)
Member of A(1)
Even followed by odd
27
Member of A(1)
Member of A(2)
Odd followed by even
28
29
So, there are two classes of solutions for two consecutive numbers.
30
Let's write this in shorthand as tuples (2,1) and (1,2)
31
As we extend this to longer ranges, it's straightforward to compute the number of solution classes but I am interested in the number of sets.
32
For length two, there is only one unique combination. Let's establish a convention that they are sorted from low to high by subscript.
33
So, the lone "set" is (Member of A(1), Member of A(2)) or (1,2) for brevity
34
35
36
L = 3
37
38
Note: That among 3 consecutive integers, at least one must be divisble by 3. We must partition A into two subsets: non-multiples and multiples of 3. Let's call these A'(3,1) and A'(3,3).
39
If the first number of the 3-reange, "x" is 2 mod 4 then x +2 must be a multiple of 4. So, with respect to powers of 2, we need to partition A into 3 sets:
40
2-unsmooth, mod 4 = 2 and mod 4 = 0 (which is why the ceiling function was used earlier).
41
42
We will call these subsets A'(2,1), A'(2,2), A'(2,4)
43
We use A' instead of A because these are intermediate sets. We want to further partition A with respect to divisibility by both 2 and 3.
44
If take the intersections of between the A'(2,_) and A'(3,_) sets, we have 3 * 2 = 6. We will label A(ij) = intersection of A'(2,i) and A'(3,j)
45
This gives us A(1), A(2), A(3), A(4), A(6), A(12).
46
Let's look at the possible valid combinations for powers of 2 and 3 and let's say mA'(x,y) means member of the set A'(x,y)
47
48
xx + 1x +2xx + 1x +2
49
mA'(2,4)mA'(2,1)mA'(2,2)mA'(3,3)mA'(3,1)mA'(3,1)
50
mA'(2,1)mA'(2,4)mA'(2,1)mA'(3,1)mA'(3,3)mA'(3,1)
51
mA'(2,2)mA'(2,1)mA'(2,4)mA'(3,1)mA'(3,1)mA'(3,3)
52
mA'(2,1)mA'(2,2)mA'(2,1)
53
54
The notation above is a little cumbersome. Let's replace the entries with 2nd subscript and use that convention going forward and also indicate if they are symmetric and has a previously occurring mirror/inverse.
55
56
xx + 1x + 2Status*xx + 1x + 2Status*
57
412N311N
58
141S131S
59
214Y113Y
60
121S
61
62
* The status is defined as either: (S)ymmetrical, Y - previous mirror processed, N - previous mirror not processed
63
64
If we take the cartesian product, we will get 4 * 3 = 12 solution classes
Cross-products
65
66
xx + 1x + 2xx + 1x + 2xx + 1x + 2
67
4123111212
68
1411311121
69
2141132112
70
121311321
71
412131=>432
72
141113143
73
214311614
74
121131161
75
412113416
76
141311341
77
214131234
78
121113123
79
80
We are interested in the number of distinct sets. Now, we have to start considering symmetry and reflection.
81
This is a reordering of the tables above to get a better handle on how symmetry/reflection of the specific power tuples factor in our calculation
82
83
xx + 1x + 2xx + 1x + 2xx + 1x + 2
84
4123111212
New set (1,2,12)
85
412113416
New set (1, 4, 6)
86
412131432
New set (2, 3, 4)
87
214311614Redundant
88
214113=>2112Redundant
89
214131234Redundant
90
141311341
New set (1, 3, 4)
91
141113143Redundant
92
1411311121
New set (1, 1, 12)
93
121311321
New set (1,2, 3)
94
121113123Redundant
95
121131161
New set (1, 1, 6)
96
7 unique sets in all
97
Insights:
98
(2,1,4) is the mirror image of (4,1,2) so it cannot contrubute any new sets. (4,1,2) has already contributed them.
99
(1,4,1) and (1,2,1)'s behavior with respect to contributing new sets is the same (because they are symmetrical).
100
As (1,4,1) is symmetrical, when combined with (3,1,1) and (1,1,3) there will only be one new set contributed from those two cross-products.