OFFSET
1,3
COMMENTS
REFERENCES
Thomas Koshy, Pell and Pell-Lucas Numbers with Applications, Springer New York Heidelberge Dordrecht London, Cambridge, 2014, p.193
LINKS
Wipawee Tangjai, Density and spacing properties of some families of non-standard ternary representations, Doctoral Dissertation, University of Illinois at Urbana-Champaign, 2014.
Wipawee Tangjai, A Non-standard Ternary Representation of Integers, Thai J. Math (2020) Special Issue: Annual Meeting in Mathematics 2019, 269-283.
FORMULA
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)) ...
EXAMPLE
a(1) = 0;
a(2) = 3*a(1) + 1 = 1;
a(3) = 3*a(2) = 3;
a(4) = 3*a(2) + 1;
a(5) = 3*a(1) + 5 = 5;
a(6) = 3*a(2) + 5.
MATHEMATICA
Select[Union[Table[FromDigits[IntegerDigits[k, 3] /. 2 -> 5, 3], {k, 0, 3^5 - 1}]], # < 3^5 &] (* Giovanni Resta, Jun 24 2016 *)
PROG
(R) #This program generates numbers from a(1) to a(135)
#it can be increased by changing number of k
m3<-function(x, k){
for(j in 1:k){
A=array(3*x[1])
B=array(3*x[1]+1)
C=array(3*x[1]+5)
for(i in 2:length(x)){
A=c(A, 3*x[i])
B=c(B, 3*x[i]+1)
C=c(C, 3*x[i]+5)
result=sort(union(x, union(A, union(B, C))), decreasing = FALSE)
}
x=result
}
return(result)
}
S=array(0)
U=m3(S, 3) #row r-1
V=m3(S, 4) #row r
up=ceiling((V[length(V)]-5)/3) # find the max element in r that less than in r-1
Y1=V[V<up]#take elt in r less than up
Y2=setdiff(Y1, U) #elt in r less than up not in r-1
Y3=m3(Y2, 1) # elt apply the rec to elt in Y2
Re=sort(union(V, Y3))
Re2=paste(Re, sep=", ", collapse=", ")
write.table(Re2, file="A015Sequence.txt")
CROSSREFS
KEYWORD
nonn
AUTHOR
Wipawee Tangjai, Jun 15 2016
STATUS
approved