In the work on another question in MSE I have a formula $f(n)$ whose pattern depending on $n \in \Bbb N$ I want decode into an algebraical formula (see a short rationale of $f(n) at the end).
Beginning with the most simple $n$ - namely that which consist of pairs of primes $p,q$ with $n=pq$ - it seems (for the first dozen primes $q,p$) that the following does correctly reproduce the found pattern of $f(n)$
$$x_{p,q}={(p-1)(q-1) \over \gcd(q-1,p-1)} \cdot \text{div}(p-1,q,1/q,1) \cdot \text{div}(q-1,p,1/p,1) \tag 1$$
I thought that it might be a better handling of the formula not to write a case{} clause but a function instead:
$$\text{div}(n,m,w_\text{true},w_\text{false} ) =
\left\{ \begin{matrix}
w_\text{true} & \text{if } m \mid n \\
w_\text{false} & \text{if } m \not \mid n \\
\end{matrix} \right. $$
which, in words, means, that the left fraction in $x_{p,q}$ is additionally divided by $p$ if $p$ divides $q-1$ or divided by $q$ if $q$ divides $p-1$ (it cannot happen that both conditions are true).
As mentioned, for some small $p,q$ this formula works, but because it is an ungly one and difficult to handle, I hope there is a way to express it more concisely/to remove possible redundancy or what.
(Update) This is another notation: Let $$ w_{p,q} = {(p-1)(q-1) \over \gcd(q-1,p-1)} \qquad $$ then $$ f(n) \underset{\text{hypothesis}}= x_{p,q} =\left\{ \begin{array} {} & w_{p,q} / p &\text{ if } p \mid q-1 \\ & w_{p,q} / q &\text{ if } q \mid p-1 \\ & w_{p,q} &\text{ else } \\ \end{array} \right. \tag 2 $$
Update 2 It seems an equivalent formula to (1) in a more algebraic form is
$$ f(n)\underset{\text{hypothesis}}=x_{p,q}={(p-1)(q-1) \over \gcd(q-1,p-1)\gcd(q-1,p)\gcd(q,p-1)} \tag 3$$
It seems even to be a generalization of (1) because it fits the pattern of my function even when $p^A \mid q-1$ with some $A>1$ .
(I have not yet the analoguous pattern when more primefactors are involved, but I think it shall be helpful to have already some reduction in this version of exactly $2$ primefactors)
Q: Can the formula (3) for $x_{p,q}$ be compactified even more?
Here is a small table (I've tested this also with a $48 \times 48$-table).
Let $n=p \cdot q$ where $p,q \in \Bbb P$ then my function $f(n)$ gives the values:
p\q | 2 3 5 7 11 13 17 19 23 29 31 37 |
- + - - - - - - - - - - - - +
2 | 1 1 2 3 5 6 8 9 11 14 15 18 |
3 | 1 2 4 2 10 4 16 6 22 28 10 12 |
5 | 2 4 4 12 4 12 16 36 44 28 12 36 |
7 | 3 2 12 6 30 12 48 18 66 12 30 36 |
11 | 5 10 4 30 10 60 80 90 10 140 30 180 |
13 | 6 4 12 12 60 12 48 36 132 84 60 36 |
17 | 8 16 16 48 80 48 16 144 176 112 240 144 |
19 | 9 6 36 18 90 36 144 18 198 252 90 36 |
23 | 11 22 44 66 10 132 176 198 22 308 330 396 |
29 | 14 28 28 12 140 84 112 252 308 28 420 252 |
31 | 15 10 12 30 30 60 240 90 330 420 30 180 |
37 | 18 12 36 36 180 36 144 36 396 252 180 36 |
- + - - - - - - - - - - - - +
That values $f(pq)$ are nicely reproduced by $x_{p,q}$ according to the formula (3) up to $p,q \le 223$ and $p,q \in \Bbb P$
(Numbertheoretical) background
The function $f(n)$ stems from the problem to determine periodicity in the sequence $ S_n =\{k^k \}_{ k \gt 0} \pmod n$ depending on $n$. It is relatively easy to find that we'll have a period of length $L=\varphi(n^2)$ . But in many cases $n$ we find that there is a smaller period length, however it is always a divisor of $L$. The function $f(n)$ is that minimal period length (I determine that by analyzing the sequence $S_n$ empirically (only using Euler's totient function to simplify computation)). This is an analogon to the Carmichael function and to the "order of multiplicative cyclic subgroups".
For the basic problem see the MSE-question which I've linked already in the beginning of the post (they used "m" where I use "n" here).
CarmichaelLambda(3 * 7)I get $6$, while $f(3 \cdot 7)=2$ , so the functions don't coincide completely. – Gottfried Helms Jul 25 '17 at 15:16