%I #39 Jul 21 2020 22:25:29
%S 0,1,3,4,5,8,9,10,12,13,14,15,16,17,20,24,25,27,28,29,30,31,32,35,36,
%T 37,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,56,60,61,65,72,73,75,
%U 76,77,80,81,82,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,101,105,106,108,109,110,111,112,113
%N Ternary representation with index set {0, 1, 5}.
%C A number m is in the sequence if m = b_r * 3^r + b_(r-1) * 3^(r-1) + ... + b_0, where b_i is in {0, 1, 5}.
%C The maximal sets of consecutive numbers in this sequences can be associated with the Fibonacci numbers (A000045) and Pell numbers (A000129).
%D Thomas Koshy, Pell and Pell-Lucas Numbers with Applications, Springer New York Heidelberge Dordrecht London, Cambridge, 2014, p.193
%H Wipawee Tangjai, <a href="https://www.ideals.illinois.edu/handle/2142/50750">Density and spacing properties of some families of non-standard ternary representations</a>, Doctoral Dissertation, University of Illinois at Urbana-Champaign, 2014.
%H Wipawee Tangjai, <a href="http://thaijmath.in.cmu.ac.th/index.php/thaijmath/article/view/4478">A Non-standard Ternary Representation of Integers</a>, Thai J. Math (2020) Special Issue: Annual Meeting in Mathematics 2019, 269-283.
%F G.f.: (1/(1-x))(1-x^2+x^3)(1-x^(2*3)+x^(3^2))...(1-x^(2*3^k)+x^(3^(k+1)) ...
%e a(1) = 0;
%e a(2) = 3*a(1) + 1 = 1;
%e a(3) = 3*a(2) = 3;
%e a(4) = 3*a(2) + 1;
%e a(5) = 3*a(1) + 5 = 5;
%e a(6) = 3*a(2) + 5.
%t Select[Union[Table[FromDigits[IntegerDigits[k, 3] /. 2 -> 5, 3], {k, 0, 3^5 - 1}]], # < 3^5 &] (* _Giovanni Resta_, Jun 24 2016 *)
%o (R) #This program generates numbers from a(1) to a(135)
%o #it can be increased by changing number of k
%o m3<-function(x, k){
%o for(j in 1:k){
%o A=array(3*x[1])
%o B=array(3*x[1]+1)
%o C=array(3*x[1]+5)
%o for(i in 2:length(x)){
%o A=c(A,3*x[i])
%o B=c(B,3*x[i]+1)
%o C=c(C,3*x[i]+5)
%o result=sort(union(x,union(A,union(B,C))), decreasing = FALSE)
%o }
%o x=result
%o }
%o return(result)
%o }
%o S=array(0)
%o U=m3(S,3) #row r-1
%o V=m3(S,4) #row r
%o up=ceiling((V[length(V)]-5)/3) # find the max element in r that less than in r-1
%o Y1=V[V<up]#take elt in r less than up
%o Y2=setdiff(Y1,U) #elt in r less than up not in r-1
%o Y3=m3(Y2,1) # elt apply the rec to elt in Y2
%o Re=sort(union(V,Y3))
%o Re2=paste(Re,sep=",",collapse=",")
%o write.table(Re2,file="A015Sequence.txt")
%Y Cf. A000045 (Fibonacci numbers), A000129 (Pell numbers), A001333 (Pell-Lucas numbers). Superset of A005836.
%K nonn
%O 1,3
%A _Wipawee Tangjai_, Jun 15 2016