%I #9 Sep 01 2018 06:12:18
%S 1,1,5,-1,6,5,2,6,25,-15,26,-5,18,-4,30,-14,31,25,-6,26,10,12,11,30,
%T -5,31,125,-97,126,-75,106,-74,130,-96,131,-25,62,-24,90,-50,91,-20,
%U 63,-19,150,-104,151,-70,119,-69,155,-103,156,125,-70,126,-30,88,-29,130,-69,131,50,14,51,60,7,61,55,15,56,150
%N a(1) = 1, a(n) = 5*a(n/3) if n is divisible by 3, otherwise a(n) = n - a(n-1).
%C From a generalization of A317825.
%H Antti Karttunen, <a href="/A318265/b318265.txt">Table of n, a(n) for n = 1..19682</a>
%H Altug Alkan, <a href="/A318265/a318265.png">A scatterplot of a(n) for n <= 3^10-1</a>
%H Rémy Sigrist, <a href="/A318265/a318265_1.png">A colored scatterplot of (A318265(n), A305865(n)) for n = 1..3^13-1 (color is function of n)</a>
%o (PARI) a(n)=if(n==1, n, if(n%3==0, 5*a(n/3),n-a(n-1)));
%Y Cf. A305865, A317825.
%K sign,look
%O 1,3
%A _Altug Alkan_ and _Antti Karttunen_, Aug 22 2018