login
A331694
For any n > 0, let d_1, ..., d_k be the divisors of n, in ascending order; set e_0 = 0 and for i = 1..k, if e_{i-1} >= d_i then set e_i = e_{i-1} - d_i else set e_i = e_{i-1} + d_i; a(n) = e_k.
2
1, 3, 4, 7, 6, 6, 8, 15, 13, 18, 12, 22, 14, 24, 24, 31, 18, 33, 20, 32, 32, 36, 24, 38, 31, 42, 40, 42, 30, 46, 32, 63, 48, 54, 48, 67, 38, 60, 56, 60, 42, 48, 44, 84, 60, 72, 48, 54, 57, 93, 72, 98, 54, 60, 72, 106, 80, 90, 60, 66, 62, 96, 86, 127, 84, 72
OFFSET
1,2
COMMENTS
This sequence has similarities with A084110.
Fixed points appear to be sparse; the first few are 1, 6, 126, 198, 1433322, 317533782, 386625738, 451240398.
LINKS
FORMULA
a(p^k) = (p^(k+1)-1)/(p-1) for any k >= 0 and any prime number p.
n <= a(n) < 2*n.
EXAMPLE
For n = 30:
- we have:
k e_k d_k
- --- ---
0 0 N/A
1 1 1
2 3 2
3 0 3
4 5 5
5 11 6
6 1 10
7 16 15
8 46 30
- so a(30) = 46.
PROG
(PARI) a(n) = my (e=0); fordiv (n, d, if (e>=d, e-=d, e+=d)); e
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Jan 25 2020
STATUS
approved