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.

Previous Showing 31-38 of 38 results.

A217113 Greatest number (in decimal representation) with n nonprime substrings in base-3 representation (substrings with leading zeros are considered to be nonprime).

Original entry on oeis.org

2, 23, 71, 26, 77, 233, 239, 719, 701, 647, 725, 2159, 2177, 2158, 2157, 5822, 5741, 6551, 6476, 6532, 6531, 18944, 19436, 19655, 19601, 19673, 19653, 58310, 58309, 58316, 58967, 59021, 58964, 157211, 157217, 174950, 176408, 176407, 176903, 177065, 177064, 471653, 511511
Offset: 0

Views

Author

Hieronymus Fischer, Dec 20 2012

Keywords

Comments

The sequence is well-defined in that for each n the set of numbers with n nonprime substrings is not empty and finite. Proof of existence: Define m(n):=2*sum_{j=i..k} 3^j, where k:=floor((sqrt(8n+1)-1)/2), i:= n-(k(k+1)/2). For n=0,1,2,3,... the m(n) in base-3 representation are 2, 22, 20, 222, 220, 200, 2222, 2220, 2200, 2000, 22222, 22220, .... m(n) has k+1 digits and (k-i+1) 2’s. Thus, the number of nonprime substrings of m(n) is ((k+1)(k+2)/2)-k-1+i=(k(k+1)/2)+i=n. This proves the statement of existence. Proof of finiteness: Each 2-digit base-3 number has at least 1 nonprime substring. Hence, each 2(n+1)-digit number has at least n+1 nonprime substrings. Consequently, there is a boundary b < 3^(2n+1) such that all numbers > b have more than n nonprime substrings. It follows, that the set of numbers with n nonprime substrings is finite.

Examples

			a(0) = 2, since 2 = 2_3 (base-3) is the greatest number with zero nonprime substrings in base-3 representation.
a(1) = 23 = 212_3 has 1 substring in base-3 representation (= 1). All the other base-3 substrings (2, 2, 21, 12, 212) are prime substrings. 23 is the greatest number with 1 nonprime substring.
a(2) = 71 = 2122_3 has 10 substrings in base-3 representation (1, 2, 2, 2, 12, 21, 22, 122, 212, 2122), exactly 2 of them are nonprime substrings (1 and 22_3=8), and there is no greater number with 2 nonprime substrings in base-3 representation.
a(3) = 26 = 222_3 has 6 substrings in base-3 representation, only 3 of them are prime substrings (2, 2, 2) which implies that exactly 3 substrings must be nonprime, and there is no greater number with 3 nonprime substrings in base-3 representation.
		

Crossrefs

Formula

a(n) >= A217103(n).
a(n) >= A217303(A000217(A081604(a(n)))-n).
Example: a(12)=2177=2222122_3, A000217(A081604(2177))=28, hence a(12)>=A217303(28-12)=1934.
a(n) <= 3^min(n + 2, 5*floor((n+4)/5)).
a(n) <= 3^(n + 2).
a(n) <= 3^min((n + 11)/3, 11*floor((n+32)/33)).
a(n) <= 3^((1/3)*(n + 11)).
With m := floor(log_3(a(n))) + 1:
a(n+m+1) >= 3*a(n), if a(n)!=1 (mod 3).
a(n+m) >= 3*a(n), if a(n)=1 (mod 3).

A262438 Number of digits of hexadecimal representation of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 0

Views

Author

Reinhard Zumkeller, Sep 22 2015

Keywords

Comments

Length of n-th row in A262437.

Crossrefs

Programs

  • Haskell
    a262438 = length . a262437_row
    
  • Maple
    A262438 := proc(n)
        if n =0 then
            1;
        else
            1+floor(log[16](n)) ;
        end if;
    end proc: # R. J. Mathar, Dec 14 2015
  • PARI
    a(n) = if (n, #digits(n, 16), 1); \\ Michel Marcus, Dec 14 2015

A370932 For any number n >= 0 with ternary expansion Sum_{i >= 0} t_i * 3^i, a(n) = Sum_{i >= 0} ((Sum_{j >= 0} (-1)^j * t_{i+j}) mod 3) * 3^i.

Original entry on oeis.org

0, 1, 2, 5, 3, 4, 7, 8, 6, 16, 17, 15, 9, 10, 11, 14, 12, 13, 23, 21, 22, 25, 26, 24, 18, 19, 20, 50, 48, 49, 52, 53, 51, 45, 46, 47, 27, 28, 29, 32, 30, 31, 34, 35, 33, 43, 44, 42, 36, 37, 38, 41, 39, 40, 70, 71, 69, 63, 64, 65, 68, 66, 67, 77, 75, 76, 79, 80
Offset: 0

Views

Author

Rémy Sigrist, Mar 06 2024

Keywords

Comments

In other words, the k-th ternary digit of a(n) is congruent (modulo 3) to the alternate sum of the digits to the left of (and including) the k-th ternary digit of n.
This sequence is a permutation of the nonnegative integers with inverse A071770 that preserves the number of ternary digits (A081604) and the leading ternary digit (A122586).

Examples

			For n = 42: the ternary expansion of 42 is "1120"; also:
     + 1             = 1 (mod 3)
     - 1 + 1         = 0 (mod 3)
     + 1 - 1 + 2     = 2 (mod 3)
     - 1 + 1 - 2 + 0 = 1 (mod 3)
- so the ternary expansion of a(42) is "1021", and a(42) = 34.
		

Crossrefs

Cf. A006068 (base-2 analog), A081604, A105529, A122586, A071770 (inverse).

Programs

  • PARI
    a(n, base = 3) = { my (d = digits(n, base), s = 0); for (i = 1, #d, d[i] = (s = d[i]-s) % base;); fromdigits(d, base); }
    
  • Python
    from itertools import accumulate
    from sympy.ntheory import digits
    def A370932(n):
        t = accumulate(((-j if i&1 else j) for i, j in enumerate(digits(n,3)[1:])),func=lambda x,y: (x+y)%3)
        return int(''.join(str(-d%3 if i&1 else d) for i,d in enumerate(t)),3) # Chai Wah Wu, Mar 08 2024

Formula

A081604(a(n)) = A081604(n).
A122586(a(n)) = A122586(n).

A020911 Number of digits in the base 3 representation of n-th Fibonacci number.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A000045 (Fibonacci numbers), A081604 (base-3 digits of n).

Programs

  • Magma
    [#Intseq(Fibonacci(n),3):n in [1..70]]; // Marius A. Burtea, Jan 02 2020
  • Mathematica
    IntegerLength[Fibonacci[Range[50]],3] (* Harvey P. Dale, Aug 13 2018 *)
  • PARI
    a(n)={1 + logint(fibonacci(n), 3)} \\ Andrew Howroyd, Jan 01 2020
    

Formula

a(n) = A081604(A000045(n)). - Andrew Howroyd, Jan 01 2020

Extensions

Offset corrected and terms a(50) and beyond from Andrew Howroyd, Jan 01 2020

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

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    A037862 := proc(n)
        a := 0 ;
        dgs := convert(n,base,3);
        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
  • Mathematica
    b3d[n_]:=Module[{idn=IntegerDigits[n,3]},Count[idn,?(#<2&)]-Count[idn, ?(#>1&)]]; Array[b3d,90] (* Harvey P. Dale, Nov 08 2011 *)

Formula

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

A305878 For any number n >= 0: apply the map 0 -> "0", 1 -> "01", 2 -> "011" to the ternary representation of n and interpret the result as a binary string.

Original entry on oeis.org

0, 1, 3, 2, 5, 11, 6, 13, 27, 4, 9, 19, 10, 21, 43, 22, 45, 91, 12, 25, 51, 26, 53, 107, 54, 109, 219, 8, 17, 35, 18, 37, 75, 38, 77, 155, 20, 41, 83, 42, 85, 171, 86, 173, 347, 44, 89, 179, 90, 181, 363, 182, 365, 731, 24, 49, 99, 50, 101, 203, 102, 205, 411
Offset: 0

Views

Author

Rémy Sigrist, Jun 13 2018

Keywords

Comments

This sequence is a ternary analog of A048678.
This sequence is a permutation of A003726.

Examples

			The first terms, alongside the ternary representation of n and the binary representation of a(n), are:
  n   a(n)  tern(n)  bin(a(n))
  --  ----  -------  ---------
   0     0        0          0
   1     1        1          1
   2     3        2         11
   3     2       10         10
   4     5       11        101
   5    11       12       1011
   6     6       20        110
   7    13       21       1101
   8    27       22      11011
   9     4      100        100
  10     9      101       1001
  11    19      102      10011
  12    10      110       1010
		

Crossrefs

Programs

  • PARI
    a(n) = if (n==0, 0, my (d=n%3); a(n\3) * 2^(d+1) + (2^d-1))

Formula

a(0) = 0.
a(3*n) = 2*a(n).
a(3*n + 1) = 4*a(n) + 1.
a(3*n + 2) = 8*a(n) + 3.
A000120(a(n)) = A053735(n).

A318488 a(0) = 0, a(n) = -5*a(n/3) if n is divisible by 3, otherwise a(n) = n + a(n-1).

Original entry on oeis.org

0, 1, 3, -5, -1, 4, -15, -8, 0, 25, 35, 46, 5, 18, 32, -20, -4, 13, 75, 94, 114, 40, 62, 85, 0, 25, 51, -125, -97, -68, -175, -144, -112, -230, -196, -161, -25, 12, 50, -90, -50, -9, -160, -117, -73, 100, 146, 193, 20, 69, 119, -65, -13, 40, -375, -320, -264, -470, -412, -353, -570, -509, -447, -200, -136, -71, -310
Offset: 0

Views

Author

Altug Alkan, Aug 27 2018

Keywords

Comments

From a generalization of A318303 (compare the scatterplots in order to observe connection). In this case, A000244 is determinative for the boundaries of self-similar block structures of this sequence, i.e., n = 3^9 - 1 is a corresponding endpoint.

Crossrefs

Programs

  • Magma
    [0] cat [n eq 1 select 1 else n mod 3 eq 0 select -5*Self(n div 3) else Self(n-1)+n: n in [1..70]]; // Vincenzo Librandi, Aug 28 2018
  • Mathematica
    a[0]=0; a[n_] := a[n] = If[Mod[n, 3] == 0, -5 a[n/3], n + a[n - 1]]; Array[a, 70, 0] (* Giovanni Resta, Aug 27 2018 *)
  • PARI
    a(n)=if(n==0, 0, if(n%3, n+a(n-1), -5*a(n/3)));
    

A280724 Expansion of 1/(1 - x) + (1/(1 - x)^2)*Sum_{k>=0} x^(3^k).

Original entry on oeis.org

1, 2, 3, 5, 7, 9, 11, 13, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 07 2017

Keywords

Comments

Sums of lengths of ternary numbers (A007089).

Examples

			-----------------------
n  base 3 length  a(n)
-----------------------
0 |  0   |  1   |  1
1 |  1   |  1   |  2
2 |  2   |  1   |  3
3 |  10  |  2   |  5
4 |  11  |  2   |  7
5 |  12  |  2   |  9
6 |  20  |  2   |  11
7 |  21  |  2   |  13
8 |  22  |  2   |  15
9 |  100 |  3   |  18
-----------------------
		

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[1/(1 - x) + (1/(1 - x)^2) Sum[x^3^k, {k, 0, 15}], {x, 0, 70}], x]
    Table[1 + Sum[Floor[Log[3, k]] + 1, {k, 1, n}], {n, 0, 70}]

Formula

G.f.: 1/(1 - x) + (1/(1 - x)^2)*Sum_{k>=0} x^(3^k).
a(n) = 1 + Sum_{k=1..n} floor(log_3(k)) + 1.
Previous Showing 31-38 of 38 results.