A309155 For integer n with prime factors p_i (1 <= i <= r), with repetition, (Omega(n) = r); a(n) = Sum_{i=1..r} k_i, where k_i is the least positive integer such that p_i - k_i | n - k_i.
0, 1, 1, 2, 1, 3, 1, 3, 2, 5, 1, 4, 1, 7, 4, 4, 1, 5, 1, 4, 6, 11, 1, 5, 2, 13, 3, 6, 1, 7, 1, 5, 10, 17, 5, 6, 1, 19, 12, 7, 1, 5, 1, 10, 3, 23, 1, 6, 2, 5, 16, 12, 1, 7, 10, 9, 18, 29, 1, 8, 1, 31, 5, 6, 10, 9, 1, 16, 22, 9, 1, 7, 1, 37, 7, 18, 7, 11, 1, 6, 4, 41, 1, 10, 14
Offset: 1
Keywords
Examples
For n prime a(n) = 1; n = 4 = 2*2 —> k_1 = k_2 = 1, so a(4) = 1 + 1 = 2.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
Programs
-
Mathematica
g[n_,p_] := Module[{k=1}, While[!Divisible[n - k, p - k], k++]; k]; a[1]=0; a[n_] := Module[{f = FactorInteger[n]}, p=f[[;;,1]]; e=f[[;;,2]]; Sum[e[[k]] * g[n,p[[k]]], {k, 1, Length[p]}]]; Array[a, 85] (* Amiram Eldar, Jul 18 2019 *)
-
PARI
getk(p, n) = {my(k=1); while ((n - k) % (p - k), k++); k;} a(n) = {my(f=factor(n)); for (i=1, #f~, f[i, 1] = getk(f[i, 1], n);); sum(i=1, #f~, f[i,1]*f[i,2]);} \\ Michel Marcus, Jul 16 2019
Formula
Extensions
More terms from Michel Marcus, Jul 16 2019
Comments