[go: up one dir, main page]

login
A048328
Numbers that are repdigits in base 3.
10
0, 1, 2, 4, 8, 13, 26, 40, 80, 121, 242, 364, 728, 1093, 2186, 3280, 6560, 9841, 19682, 29524, 59048, 88573, 177146, 265720, 531440, 797161, 1594322, 2391484, 4782968, 7174453, 14348906, 21523360, 43046720, 64570081, 129140162, 193710244, 387420488, 581130733
OFFSET
0,3
COMMENTS
Case for base 2 see A000225: 2^n - 1.
If the sequence b(n) represents the number of paths of length n, n >= 1, starting at node 1 and ending at nodes 1, 2, 3 and 4 on the path graph P_5 then a(n-1) = b(n) - 1. - Johannes W. Meijer, May 29 2010
FORMULA
G.f.: (2*x^2+x)/(1-4*x^2+3*x^4). - Alois P. Heinz, Sep 23 2012
Sum_{n>=1} 1/a(n) = 3 * A214369 = 2.04646050781571420028... - Amiram Eldar, Jan 21 2022
a(n) = (3^(n/2)*(sqrt(3) + 2 - (-1)^n*(sqrt(3) - 2)) - 3 - (-1)^n)/4. - Stefano Spezia, Feb 18 2022
MAPLE
nmax := 35; a(0) := 0: for n from 1 to nmax do a(2*n) := a(2*n-2) + 2*3^(n-1); od: a(1) := 1: for n from 1 to nmax do a(2*n+1) := 1*a(2*n-1) + 3^n; od: seq(a(n), n=0..nmax);
# End program 1
with(GraphTheory): G := PathGraph(5): A:= AdjacencyMatrix(G): nmax := nmax; for n from 1 to nmax+1 do B(n) := A^n; b(n) := add(B(n)[1, k], k=1..4); a1(n-1) := b(n)-1; od: seq(a1(n), n=0..nmax);
# End program 2
# From Johannes W. Meijer, May 29 2010, revised Sep 23 2012
# third Maple program:
a:= n->(<<0|1>, <-3|4>>^iquo(n, 2, 'r').`if`(r=0, <<0, 2>>, <<1, 4>>))[1, 1]:
seq (a(n), n=0..60); # Alois P. Heinz, Sep 23 2012
MATHEMATICA
Rest[FromDigits[#, 3]&/@Flatten[Table[{PadRight[{1}, n, 1], PadRight[{2}, n, 2]}, {n, 0, 20}], 1]] (* Harvey P. Dale, Feb 03 2011 *)
PROG
(PARI) a(n)=([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; -3, 0, 4, 0]^n*[0; 1; 2; 4])[1, 1] \\ Charles R Greathouse IV, Oct 07 2015
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Patrick De Geest, Feb 15 1999
STATUS
approved