cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 12 results. Next

A110594 a(1) = 4, a(2) = 12, for n>1: a(n) = 3*4^(n-1).

Original entry on oeis.org

4, 12, 48, 192, 768, 3072, 12288, 49152, 196608, 786432, 3145728, 12582912, 50331648, 201326592, 805306368, 3221225472, 12884901888, 51539607552, 206158430208, 824633720832, 3298534883328, 13194139533312, 52776558133248
Offset: 1

Views

Author

Jonathan Vos Post, Jul 29 2005

Keywords

Crossrefs

Programs

  • GAP
    Concatenation([4],List([2..25],n->3*4^(n-1))); # Muniru A Asiru, Oct 21 2018
  • Magma
    [4] cat [3*4^(n-1): n in [2..30]]; // Vincenzo Librandi, May 29 2014
    
  • Maple
    seq(coeff(series(4*x*(1-x)/(1-4*x),x,n+1), x, n), n = 1 .. 25); # Muniru A Asiru, Oct 21 2018
  • Mathematica
    CoefficientList[Series[4 (1 - x)/(1 - 4 x), {x, 0, 40}], x] (* Vincenzo Librandi, May 29 2014 *)
  • PARI
    x='x+O('x^50); Vec(4*x*(1 - x)/(1 - 4*x)) \\ G. C. Greubel, Sep 01 2017
    

Formula

a(n) = A002001(n), n>1. - R. J. Mathar, Aug 18 2008
G.f.: 4*x*(1 - x)/(1 - 4*x). - Vincenzo Librandi, May 29 2014

Extensions

Definition corrected by R. J. Mathar, Aug 18 2008

A043000 Number of digits in all base-b representations of n, for 2 <= b <= n.

Original entry on oeis.org

2, 4, 7, 9, 11, 13, 16, 19, 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43, 45, 47, 49, 51, 54, 56, 59, 61, 63, 65, 67, 70, 72, 74, 76, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126
Offset: 2

Views

Author

Keywords

Comments

From A.H.M. Smeets, Dec 14 2019: (Start)
a(n)-a(n-1) >= 2 due to the fact that n = 10_n, so there is an increment of at least 2. If n can be written as a perfect power m^s, an additional +1 comes to it for the representation of n in each base m.
For instance, for n = 729 we have 729 = 3^6 = 9^3 = 27^2, so there is an additional increment of 3. For n = 1296 we have 1296 = 6^4 = 36^2, so there is an additional increment of 2. For n = 4096 we have 4096 = 2^12 = 4^6 = 8^4 = 16^3= 64^2, so there is an additional increment of 5. (End)

Examples

			5 = 101_2 = 12_3 = 11_4 = 10_5. Thus a(5) = 3+2+2+2 = 9.
		

Crossrefs

Programs

  • Magma
    [&+[Floor(Log(i,i*n)):k in [2..n]]:n in [1..70]]; // Marius A. Burtea, Nov 13 2019
    
  • Maple
    A043000 := proc(n) add( nops(convert(n,base,b)),b=2..n) ; end proc: # R. J. Mathar, Jun 04 2011
  • Mathematica
    Table[Total[IntegerLength[n,Range[2,n]]],{n,2,60}] (* Harvey P. Dale, Apr 23 2019 *)
  • PARI
    a(n)=sum(b=2,n,#digits(n,b)) \\ Jeppe Stig Nielsen, Dec 14 2019
    
  • PARI
    a(n)= n-1 +sum(b=2,n,logint(n,b)) \\ Jeppe Stig Nielsen, Dec 14 2019
    
  • PARI
    a(n) = {2*n-2+sum(i=2, logint(n, 2), sqrtnint(n, i)-1)} \\ David A. Corneth, Dec 31 2019
    
  • PARI
    first(n) = my(res = vector(n)); res[1] = 2; for(i = 2, n, inc = numdiv(gcd(factor(i+1)[,2]))+1; res[i] = res[i-1]+inc); res \\ David A. Corneth, Dec 31 2019
  • Python
    def count(n,b):
        c = 0
        while n > 0:
            n, c = n//b, c+1
        return c
    n = 0
    while n < 50:
        n = n+1
        a, b = 0, 1
        while b < n:
            b = b+1
            a = a + count(n,b)
        print(n,a) # A.H.M. Smeets, Dec 14 2019
    

Formula

a(n) = Sum_{i=2..n} floor(log_i(i*n)); a(n) ~ 2*n. - Vladimir Shevelev, Jun 03 2011 [corrected by Vaclav Kotesovec, Apr 05 2021]
a(n) = A070939(n) + A081604(n) + A110591(n) + ... + 1. - R. J. Mathar, Jun 04 2011
From Ridouane Oudra, Nov 13 2019: (Start)
a(n) = Sum_{i=1..n-1} floor(n^(1/i));
a(n) = n - 1 + Sum_{i=1..floor(log_2(n))} floor(n^(1/i) - 1);
a(n) = n - 1 + A255165(n). (End)
If n is in A001597 then a(A001597(m)) - a(A001597(m)-1) = 2 + A253642(m), otherwise a(n) - a(n-1) = 2. - A.H.M. Smeets, Dec 14 2019

A049803 a(n) = n mod 3 + n mod 9 + ... + n mod 3^k, where 3^k <= n < 3^(k+1).

Original entry on oeis.org

0, 0, 0, 1, 2, 0, 1, 2, 0, 2, 4, 3, 5, 7, 6, 8, 10, 0, 2, 4, 3, 5, 7, 6, 8, 10, 0, 3, 6, 6, 9, 12, 12, 15, 18, 9, 12, 15, 15, 18, 21, 21, 24, 27, 18, 21, 24, 24, 27, 30, 30, 33, 36, 0, 3, 6, 6, 9, 12, 12, 15, 18, 9, 12, 15, 15, 18, 21, 21, 24, 27, 18
Offset: 1

Views

Author

Keywords

Comments

From Petros Hadjicostas, Dec 11 2019: (Start)
Conjecture: For b >= 2, consider the function s(n,b) = Sum_{1 <= b^j <= n} (n mod b^j) from p. 8 in Dearden et al. (2011). Then s(b*n + r, b) = b*s(n,b) + r*N(n,b) for 0 <= r <= b-1, where N(n,b) = floor(log_b(n)) + 1 is the number of digits in the base-b representation of n. As initial conditions, we have s(n,b) = 0 for 1 <= n <= b. (This is a generalization of a result by Robert Israel in A049802.)
Here b = 3 and a(n) = s(n,3).
We have N(n,2) = A070939(n), N(n,3) = A081604(n), N(n,4) = A110591(n), and N(n,5) = A110592(n).
If A_b(x) = Sum_{n >= 1} s(n,b)*x^n is the g.f. of the sequence (s(n,b): n >= 1) and the above conjecture is correct, then it can be proved that A_b(x) = b * A_b(x^b) * (1-x^b)/(1-x) + x * ((b-1)*x^b - b*x^(b-1) + 1)/((1-x)^2 * (1-x^b)) * Sum_{k >= 1} x^(b^k). (End)

Crossrefs

Programs

  • Maple
    a:= n-> add(irem(n, 3^j), j=1..ilog[3](n)):
    seq(a(n), n=1..105);  # Alois P. Heinz, Dec 13 2019
  • Mathematica
    Table[n * Floor@Log[3, n] - Sum[Floor[n*3^-k]*3^k, {k, Log[3, n]}], {n, 100}] (* after Federico Provvedi in A049802*) (* Metin Sariyar, Dec 12 2019 *)
  • PARI
    a(n) = sum(k=1, logint(n, 3), n % 3^k); \\ Michel Marcus, Dec 12 2019

Formula

From Petros Hadjicostas, Dec 11 2019: (Start)
Conjecture: a(3*n+r) = 3*a(n) + r*A081604(n) = 3*a(n) + r*(floor(log_3(n)) + 1) for n >= 1 and r = 0, 1, 2.
If the conjecture above is true, the g.f. A(x) satisfies A(x) = 3*(1+x+x^2)*A(x^3) + x*(2*x+1)/(1-x^3) * Sum_{k >= 1} x^(3^k). (End)

A049804 a(n) = n mod 4 + n mod 16 + ... + n mod 4^k, where 4^k <= n < 4^(k+1).

Original entry on oeis.org

0, 0, 0, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 2, 4, 6, 4, 6, 8, 10, 8, 10, 12, 14, 12, 14, 16, 18, 0, 2, 4, 6, 4, 6, 8, 10, 8, 10, 12, 14, 12, 14, 16, 18, 0, 2, 4, 6, 4, 6, 8, 10, 8, 10, 12, 14, 12, 14, 16, 18, 0, 3, 6, 9, 8, 11, 14, 17, 16, 19, 22
Offset: 1

Views

Author

Keywords

Comments

From Petros Hadjicostas, Dec 11 2019: (Start)
Conjecture: For b >= 2, consider the function s(n,b) = Sum_{1 <= b^j <= n} (n mod b^j) from p. 8 in Dearden et al. (2011). Then s(b*n + r, b) = b*s(n,b) + r*N(n,b) for 0 <= r <= b-1, where N(n,b) = floor(log_b(n)) + 1 is the number of digits in the base-b representation of n. As initial conditions, we have s(n,b) = 0 for 1 <= n <= b. (This is a generalization of a result by Robert Israel in A049802.)
Here b = 4 and a(n) = s(n,4).
We have N(n,2) = A070939(n), N(n,3) = A081604(n), N(n,4) = A110591(n), and N(n,5) = A110592(n).
If A_b(x) = Sum_{n >= 1} s(n,b)*x^n is the g.f. of the sequence (s(n,b): n >= 1) and the above conjecture is correct, then it can be proved that A_b(x) = b * A_b(x^b) * (1-x^b)/(1-x) + x * ((b-1)*x^b - b*x^(b-1) + 1)/((1-x)^2 * (1-x^b)) * Sum_{k >= 1} x^(b^k). (End)

Crossrefs

Programs

  • Maple
    a:= n-> add(irem(n, 4^j), j=1..ilog[4](n)):
    seq(a(n), n=1..105);  # Petros Hadjicostas, Dec 13 2019 (after Alois P. Heinz's program for A330358)
  • Mathematica
    Table[n * Floor@Log[4, n] - Sum[Floor[n*4^-k]*4^k, {k, Log[4, n]}], {n, 100}] (* Metin Sariyar, Dec 12 2019 *)
    a[n_] := Sum[Mod[n, 4^j], {j, 1, Length[IntegerDigits[n, 4]] - 1}];
    Array[a, 105] (* Jean-François Alcover, Dec 31 2021 *)
  • PARI
    a(n) = sum(k=1, logint(n, 4), n % 4^k); \\ Michel Marcus, Dec 12 2019

Formula

From Petros Hadjicostas, Dec 11 2019: (Start)
Conjecture: a(4*n+r) = 4*a(n) + r*A110591(n) = 4*a(n) + r*(floor(log_4(n)) + 1) for n >= 1 and r = 0, 1, 2, 3.
If the conjecture above is true, the g.f. A(x) satisfies A(x) = 4*(1 + x + x^2 + x^3)*A(x^4) + x*(1 + 2*x + 3*x^2)/(1 - x^4) * Sum_{k >= 1} x^(4^k). (End)

A330358 a(n) = n mod 5 + n mod 25 + ... + n mod 5^k, where 5^k <= n < 5^(k+1).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 2, 4, 6, 8, 5, 7, 9, 11, 13, 10, 12, 14, 16, 18, 15, 17, 19, 21, 23, 20, 22, 24, 26, 28, 0, 2, 4, 6, 8, 5, 7, 9, 11, 13, 10, 12, 14, 16, 18, 15, 17, 19, 21, 23, 20, 22, 24, 26, 28, 0, 2, 4, 6, 8, 5, 7, 9, 11, 13, 10
Offset: 1

Views

Author

Petros Hadjicostas, Dec 12 2019

Keywords

Comments

Conjecture: For b >= 2, consider the function s(n,b) = Sum_{1 <= b^j <= n} (n mod b^j) from p. 8 in Dearden et al. (2011). Then s(b*n + r, b) = b*s(n,b) + r*N(n,b) for 0 <= r <= b-1, where N(n,b) = floor(log_b(n)) + 1 is the number of digits in the base-b representation of n. As initial conditions, we have s(n,b) = 0 for 1 <= n <= b. (This is a generalization of a result by Robert Israel in A049802.)
Here b = 5 and a(n) = s(n,5).
We have N(n,2) = A070939(n), N(n,3) = A081604(n), N(n,4) = A110591(n), and N(n,5) = A110592(n).
If A_b(x) = Sum_{n >= 1} s(n,b)*x^n is the g.f. of the sequence (s(n,b): n >= 1) and the above conjecture is correct, then it can be proved that A_b(x) = b * A_b(x^b) * (1-x^b)/(1-x) + x * ((b-1)*x^b - b*x^(b-1) + 1)/((1-x)^2 * (1-x^b)) * Sum_{k >= 1} x^(b^k).

Crossrefs

Programs

  • Maple
    a:= n-> add(irem(n, 5^j), j=1..ilog[5](n)):
    seq(a(n), n=1..105);  # Alois P. Heinz, Dec 13 2019
  • Mathematica
    a[n_] := Sum[Mod[n, 5^j], {j, 1, Length[IntegerDigits[n, 5]] - 1}];
    Array[a, 105] (* Jean-François Alcover, Dec 31 2021 *)
  • PARI
    a(n) = sum(k=1, logint(n, 5), n % 5^k);
    for(n=1, 100, print1(a(n), ", ")); \\ (after Michel Marcus's program in A049804)

Formula

Conjecture: a(5*n+r) = 5*a(n) + r*A110592(n) = 5*a(n) + r*(floor(log_5(n)) + 1) for n >= 1 and r = 0, 1, 2, 3, 4.
If the conjecture above is true, the g.f. A(x) satisfies A(x) = 5*(1 + x + x^2 + x^3 + x^4)*A(x^5) + x*(1 + 2*x + 3*x^2 + 4*x^3)/(1 - x^5) * Sum_{k >= 1} x^(5^k).

A048703 Numbers which in base 4 are palindromes and have an even number of digits.

Original entry on oeis.org

0, 5, 10, 15, 65, 85, 105, 125, 130, 150, 170, 190, 195, 215, 235, 255, 1025, 1105, 1185, 1265, 1285, 1365, 1445, 1525, 1545, 1625, 1705, 1785, 1805, 1885, 1965, 2045, 2050, 2130, 2210, 2290, 2310, 2390
Offset: 0

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

In quaternary base (base 4) the terms look like 0, 11, 22, 33, 1001, 1111, 1221, 1331, 2002, 2112, 2222, 2332, 3003, 3113, 3223, 3333, 100001, 101101, 102201, ..., which is a subsequence of A118595.
Zero is included as a(0) because we can consider it as having zero digits after leading zeros have been excluded.

Examples

			Each a(n) is obtained by concatenating the original base-4 expansion of n (which comes to the left hand, i.e., the most significant side) with its mirror-image (which comes to the right hand, i.e., the least significant side). For example, for a(4) we have 4 = '10' in base 4, which concatenated with its reversal '01' yields '1001', which when converted back to decimal yields 1*64 + 0*16 + 0*4 + 1*1 = 65, thus a(4)=65.
		

Crossrefs

Subsequence of A014192 (all numbers which are palindromes in base 4, including also those of odd number of digits).
Cf. also A048704 (this sequence divided by 5), A048701 (binary palindromes of even length), A055948, A110591, A118595, A030103, A007090, A000302.

Programs

  • Maple
    A048703(n) := (n) -> (2^(floor_log_2_coarse(n)+1))*n + sum('(bit_i(n, i+((-1)^i))*(2^(floor_log_2_coarse(n)-i)))', 'i'=0..floor_log_2_coarse(n));
    bit_i := (x,i) -> `mod`(floor(x/(2^i)),2);
    # Following is like floor_log_2 but even results are incremented by one:
    floor_log_2_coarse := proc(n) local nn,i: nn := n; for i from -1 to n do if(0 = nn) then RETURN(i+(1-(i mod 2))); fi: nn := floor(nn/2); od: end:
  • Mathematica
    q[n_] := EvenQ[IntegerLength[n, 4]] && PalindromeQ[IntegerDigits[n, 4]]; Select[Range[0, 2400, 5], q] (* Amiram Eldar, May 27 2024 *)
  • Python
    def A048703(n):
        s = bin(n-1)[2:]
        if len(s) % 2: s = '0'+s
        t = [s[i:i+2] for i in range(0,len(s),2)]
        return int(''.join(t+t[::-1]),2) # Chai Wah Wu, Feb 26 2021

Formula

a(0) = 0, and for n >= 1, a(n) = A030103(n) + (n * A000302(A110591(n))). - Antti Karttunen, Oct 30 2013
a(n) = 5*A048704(n). [This is just a consequence of the definition of A048704.] - Antti Karttunen, Jul 25 2013

A260112 Minimal number of steps to get from 0 to n by (a) adding 1 or (b) multiplying by 4.

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 8, 9, 10, 11, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 5, 6, 7, 8, 6
Offset: 0

Views

Author

Peter Kagey, Jul 16 2015

Keywords

Comments

a(n) = (Weight of quaternary expansion of n) + (length of quaternary expansion of n) - 1.

Examples

			For a(308) = 9, the nine steps are: 308 => 77 => 76 => 19 => 18 => 17 => 16 => 4 => 1 => 0.
		

Crossrefs

Analogous sequences with a different multiplier k: A056792 (k=2), A061282 (k=3).
Cf. A053737, A110591, A007090: base 4 sequences.

Programs

  • Haskell
    c i = if i `mod` 4 == 0 then i `div` 4 else i - 1
    b 0 foldCount = foldCount
    b sheetCount foldCount = b (c sheetCount) (foldCount + 1)
    a260112 n = b n 0 -- Peter Kagey, Sep 02 2015
  • Maple
    a:= n-> (l-> nops(l)+add(i, i=l)-1)(convert(n, base, 4)):
    seq(a(n), n=0..105);  # Alois P. Heinz, Jul 16 2015
  • PARI
    a(n)=sumdigits(n,4)+#digits(n,4)-1 \\ Charles R Greathouse IV, Jul 16 2015
    
  • Ruby
    def a(n); n.to_s(4).length + n.to_s(4).split('').map(&:to_i).reduce(:+) - 1 end
    

Formula

a(n) = A053737(n) + A110591(n) - 1. - Michel Marcus, Jul 17 2015

A037863 a(n) = (number of digits <=1) - (number of digits >1) in base 4 representation of n.

Original entry on oeis.org

1, -1, -1, 2, 2, 0, 0, 0, 0, -2, -2, 0, 0, -2, -2, 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -3, -3, -1, -1, -3, -3, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -3, -3, -1, -1, -3, -3, 4, 4, 2, 2, 4, 4, 2, 2, 2, 2, 0, 0
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    A037863 := proc(n)
        a := 0 ;
        dgs := convert(n,base,4);
        for i from 1 to nops(dgs) do
            if op(i,dgs)<=1 then
                a := a+1 ;
            else
                a := a-1 ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Oct 16 2015
  • PARI
    a(n) = my(d=digits(n, 4)); #select(x->(x<=1), d) - #select(x->(x>1), d); \\ Michel Marcus, Jan 27 2025

Formula

a(n) = A110591(n)-2*A139352(n). - R. J. Mathar, Jan 27 2025

A020912 Number of terms in base 4 representation of n-th Fibonacci number.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27
Offset: 1

Views

Author

Keywords

Programs

  • Maple
    A020912 := proc(n) nops(convert(combinat[fibonacci](n),base,4)) ; end: seq(A020912(n),n=1..120) ; # R. J. Mathar, Feb 18 2008
  • Mathematica
    Length/@IntegerDigits[Fibonacci[Range[80]],4] (* Harvey P. Dale, Jul 27 2011 *)

Formula

a(n) = A110591(A000045(n)). - R. J. Mathar, Feb 18 2008

Extensions

More terms from R. J. Mathar, Feb 18 2008

A110595 a(1)=5. For n > 1, a(n) = 4*5^(n-1) = A005054(n).

Original entry on oeis.org

5, 20, 100, 500, 2500, 12500, 62500, 312500, 1562500, 7812500, 39062500, 195312500, 976562500, 4882812500, 24414062500, 122070312500, 610351562500, 3051757812500, 15258789062500, 76293945312500, 381469726562500
Offset: 1

Views

Author

Jonathan Vos Post, Jul 29 2005

Keywords

Comments

a(n) is the number of n-digit integers that contain only even digits (A014263). - Bernard Schott, Nov 11 2022

Crossrefs

Programs

  • Mathematica
    Join[{5},NestList[5#&,20,20]] (* Harvey P. Dale, Jun 19 2013 *)
    Rest[CoefficientList[Series[5 x (1 - x)/(1 - 5 x), {x,0,50}], x]] (* G. C. Greubel, Sep 01 2017 *)
  • PARI
    my(x='x+O('x^50)); Vec(5*x*(1-x)/(1-5*x)) \\ G. C. Greubel, Sep 01 2017

Formula

O.g.f.: 5*x*(1-x)/(1-5*x). - Better definition from R. J. Mathar, May 13 2008
Sum_{n>=1} 1/a(n) = 21/80. - Bernard Schott, Nov 11 2022

Extensions

Better definition from R. J. Mathar, May 13 2008
Incorrect comment removed by Michel Marcus, Nov 11 2022
Showing 1-10 of 12 results. Next