

A140523


If the highest power of the prime p that divides n is p^b(n,p), then a(n) is the least nonnegative integer that equals some sum{pn} (+or)p^b(n, p).


1



0, 2, 3, 4, 5, 1, 7, 8, 9, 3, 11, 1, 13, 5, 2, 16, 17, 7, 19, 1, 4, 9, 23, 5, 25, 11, 27, 3, 29, 0, 31, 32, 8, 15, 2, 5, 37, 17, 10, 3, 41, 2, 43, 7, 4, 21, 47, 13, 49, 23, 14, 9, 53, 25, 6, 1, 16, 27, 59, 2, 61, 29, 2, 64, 8, 6, 67, 13, 20, 0, 71, 1, 73, 35, 22, 15, 4, 8, 79, 11, 81, 39, 83
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS

Robert Israel, Table of n, a(n) for n = 1..10000


EXAMPLE

60 has the prime factorization: 2^2 * 3^1 * 5^1. The least nonnegative integer that is made by either adding or subtracting the prime powers in this prime factorization is: a(60) = + 2^2 + 3^1  5^1 = 2.


MAPLE

f:= proc(n) local F, V, i;
F:= map(t > t[1]^t[2], ifactors(n)[2]);
V:= {F[1]};
for i from 2 to nops(F) do
V:= map(t > (t+F[i], tF[i]), V);
od:
min(map(abs, V))
end proc:
f(1):= 0:
map(f, [$1..100]); # Robert Israel, Sep 12 2018


MATHEMATICA

f[n_] := Module[{F, V}, F = Power @@@ FactorInteger[n]; V = {F[[1]]}; Do[V = {# + F[[i]], #  F[[i]]}& /@ V // Flatten, {i, 2, Length[F]}]; V // Abs // Min];
f[1] = 0;
Array[f, 100] (* JeanFrançois Alcover, Aug 28 2020, after Robert Israel *)


CROSSREFS

Sequence in context: A286594 A241479 A100994 * A237517 A332883 A017666
Adjacent sequences: A140520 A140521 A140522 * A140524 A140525 A140526


KEYWORD

nonn


AUTHOR

Leroy Quet, Jul 02 2008


EXTENSIONS

Extended by Ray Chandler, Jun 25 2009


STATUS

approved



