login
A248820
a(1)=0; a(n+1) = a(n) - gpf(n) if a(n) >= gpf(n), otherwise a(n+1) = a(n) + lpf(n), where gpf(n) is the greatest prime dividing n (A006530) and lpf(n) is the least prime dividing n (A020639).
1
0, 1, 3, 0, 2, 7, 4, 11, 9, 6, 1, 12, 9, 22, 15, 10, 8, 25, 22, 3, 5, 8, 10, 33, 30, 25, 12, 9, 2, 31, 26, 57, 55, 44, 27, 20, 17, 54, 35, 22, 17, 58, 51, 8, 10, 5, 7, 54, 51, 44, 39, 22, 9, 62, 59, 48, 41, 22, 24, 83, 78, 17, 19, 12, 10, 15, 4, 71, 54, 31, 24
OFFSET
1,3
COMMENTS
By convention, gpf(1) = lpf(1) = 1.
a(n) = 0 for n = 1, 4, 154, 186, 287, 641, 903, 980, 1626, 1847, 3761, 5024, 11563, 20471, 23046, 31082, 31219, 34866, 40339, ...
LINKS
EXAMPLE
a(1) = 0;
a(2) = a(1) + lpf(1) = 0 + 1 = 1 because a(1) < gpf(1);
a(3) = a(2) + lpf(2) = 1 + 2 = 3 because a(2) < gpf(2);
a(4) = a(3) - gpf(3) = 3 - 3 = 0 because a(3) = gpf(3);
a(5) = a(4) + gpf(4) = 0 + 2 = 2 because a(4) < gpf(4);
a(6) = a(5) + gpf(5) = 2 + 5 = 7 because a(5) < gpf(5);
a(7) = a(6) - gpf(6) = 7 - 3 = 4 because a(6) > gpf(6).
MAPLE
with(numtheory):a1:=1:printf(`%d, `, 0):printf(`%d, `, 1):
for n from 2 to 200 do :
x:=factorset(n):n1:=nops(x):d:=x[n1]:
if a1-d<0
then
a1:=a1+x[1]:
else
a1:=a1-d:
fi:
printf(`%d, `, a1):
od:
CROSSREFS
Sequence in context: A282694 A374062 A011075 * A085550 A223139 A302278
KEYWORD
nonn
AUTHOR
Michel Lagneau, Oct 15 2014
STATUS
approved