OFFSET
1,2
COMMENTS
Is this sequence a permutation of the positive integers? (Equivalently, does A162961 take every positive integer as a value?)
LINKS
Michel Marcus, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = min{k : A162961(k) = n}.
a(p^k) = p^k for all prime powers p^k, and a(p^k-1) = 2*p^k for p^k an odd prime power that is not a Fermat prime or 9.
PROG
(PARI) isokp(m, perm, f, nb) = {for (k=1, nb, if ((m+k-1) % f[perm[k], 1]^f[perm[k], 2], return (0)); ); return (1); }
isokm(m, f, nb) = {for (j=0, nb!-1, my(perm = numtoperm(nb, j)); if (isokp(m, perm, f, nb), return (1)); ); return (0); }
a162961(n) = {my(f = factor(n), nb = #f~, m = 1); while (! isokm(m, f, nb), m++); m; }
a(n) = {my(k=1); while (a162961(k) != n, k++); k; } \\ Michel Marcus, Feb 05 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Charlie Neder, Feb 04 2019
STATUS
approved