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 10 results.

A062383 a(0) = 1: for n>0, a(n) = 2^floor(log_2(n)+1) or a(n) = 2*a(floor(n/2)).

Original entry on oeis.org

1, 2, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 128, 128, 128, 128, 128, 128
Offset: 0

Views

Author

Antti Karttunen, Jun 19 2001

Keywords

Comments

Informally, write down 1 followed by 2^k 2^(k-1) times, for k = 1,2,3,4,... These are the denominators of the binary van der Corput sequence (see A030101 for the numerators). - N. J. A. Sloane, Dec 01 2019
a(n) is the denominator of the form 2^k needed to make the ratio (2n-1)/2^k lie in the interval [1-2], i.e. such ratios are 1/1, 3/2, 5/4, 7/4, 9/8, 11/8, 13/8, 15/8, 17/16, 19/16, 21/16, ... where the numerators are A005408 (The odd numbers).
Let A_n be the upper triangular matrix in the group GL(n,2) that has zero entries below the diagonal and 1 elsewhere. For example for n=4 the matrix is / 1,1,1,1 / 0,1,1,1 / 0,0,1,1 / 0,0,0,1 /. The order of this matrix as an element of GL(n,2) is a(n-1). - Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 14 2001
A006257(n)/a(n) = (0, 0.1, 0.01, 0.11, 0.001, ...) enumerates all binary fractions in the unit interval [0, 1). - Fredrik Johansson, Aug 14 2006
a(n) = maximum of row n+1 in A240769. - Reinhard Zumkeller, Apr 13 2014
This is the discriminator sequence for the odious numbers. - N. J. A. Sloane, May 10 2016
From Jianing Song, Jul 05 2025: (Start)
a(n) is the period of {binomial(N,n) mod 2: N in Z}. For the general result, see A349593.
Since the modulus (2) is a prime, the remainder of binomial(N,n) is given by Lucas's theorem. (End)

Crossrefs

Apart from the initial term, equals 2 * A053644. MASKTRANSi(A062383) seems to give a signed form of A038712. (See identities at A053644). floor_log_2 given in A054429.
Equals A003817(n)+1. Cf. A002884.
Bisection of A065285. Cf. A076877.
Equals for n>=1 the r(n) sequence of A160464. - Johannes W. Meijer, May 24 2009
Equals the r(n) sequence of A162440 for n>=1. - Johannes W. Meijer, Jul 06 2009
Discriminator of the odious numbers (A000069). - Jeffrey Shallit, May 08 2016
Column 2 of A349593. A064235 (if offset 0), A385552, A385553, and A385554 are respectively columns 3, 5, 6, and 10.

Programs

  • Haskell
    import Data.List (transpose)
    a062383 n = a062383_list !! n
    a062383_list = 1 : zs where
       zs = 2 : (map (* 2) $ concat $ transpose [zs, zs])
    -- Reinhard Zumkeller, Aug 27 2014, Mar 13 2014
    
  • Magma
    [2^Floor(Log(2,2*n+1)): n in [0..70]]; // Bruno Berselli, Mar 04 2016
    
  • Maple
    [seq(2^(floor_log_2(j)+1),j=0..127)]; or [seq(coerce1st_octave((2*j)+1),j=0..127)]; or [seq(a(j),j=0..127)];
    coerce1st_octave := proc(r) option remember; if(r < 1) then coerce1st_octave(2*r); else if(r >= 2) then coerce1st_octave(r/2); else (r); fi; fi; end;
    A062383 := proc(n)
        option remember;
        if n = 0 then
            1 ;
        else
            2*procname(floor(n/2));
        end if;
    end proc:
    A062383 := n -> 1 + Bits:-Iff(n, n):
    seq(A062383(n), n=0..69); # Peter Luschny, Sep 23 2019
  • Mathematica
    a[n_] := a[n] = 2 a[n/2 // Floor]; a[0] = 1; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Mar 04 2016 *)
    Table[2^Floor[Log2[n] + 1], {n, 0, 20}] (* Eric W. Weisstein, Nov 17 2017 *)
    2^Floor[Log2[Range[0, 20]] + 1] (* Eric W. Weisstein, Nov 17 2017 *)
    2^BitLength[Range[0, 100]] (* Paolo Xausa, Jan 29 2025 *)
  • PARI
    { a=1; for (n=0, 1000, write("b062383.txt", n, " ", a*=ceil((n + 1)/a)) ) } \\ Harry J. Smith, Aug 06 2009
    
  • PARI
    a(n)=1<<(log(2*n+1)\log(2)) \\ Charles R Greathouse IV, Dec 08 2011
    
  • Python
    def A062383(n): return 1 << n.bit_length() # Chai Wah Wu, Jun 30 2022

Formula

a(1) = 1 and a(n+1) = a(n)*ceiling(n/a(n)). - Benoit Cloitre, Aug 17 2002
G.f.: 1/(1-x) * (1 + Sum_{k>=0} 2^k*x^2^k). - Ralf Stephan, Apr 18 2003
a(n) = A142151(2*n)/2 + 1. - Reinhard Zumkeller, Jul 15 2008
log(a(n))/log(2) = A029837(n+1). - Johannes W. Meijer, Jul 06 2009
a(n+1) = a(n) + A099894(n). - Reinhard Zumkeller, Aug 06 2009
a(n) = A264619(n) - A264618(n). - Reinhard Zumkeller, Dec 01 2015
a(n) is the smallest power of 2 > n. - Chai Wah Wu, Nov 04 2016
a(n) = 2^ceiling(log_2(n+1)). - M. F. Hasler, Sep 20 2017

A349593 Square array read by downward diagonals: for n >= 0, k >= 1, T(n,k) is the period of {binomial(N,n) mod k: N in Z}.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 4, 1, 1, 4, 3, 4, 1, 1, 5, 8, 9, 8, 1, 1, 6, 5, 8, 9, 8, 1, 1, 7, 12, 5, 16, 9, 8, 1, 1, 8, 7, 36, 5, 16, 9, 8, 1, 1, 9, 16, 7, 72, 25, 16, 9, 16, 1, 1, 10, 9, 16, 7, 72, 25, 16, 9, 16, 1, 1, 11, 20, 27, 32, 7, 72, 25, 32, 27, 16, 1
Offset: 0

Views

Author

Jianing Song, Nov 27 2021

Keywords

Comments

Since binomial(N,n) is defined for all integers N, there is no need to assume that N >= n.
Let Q(N) = 1 if k | binomial(N,n), 0 otherwise. Then T(n,k) is also the period of {Q(N): N in Z}.
By the formula given below, the n-th row is identical to the (n-1)th row if and only if n is not a power of a prime, i.e., n is in A024619. - Jianing Song, Jul 03 2025

Examples

			Rows 0..10:
  1,  1,  1,  1,  1,   1,  1,  1,  1,   1, ...
  1,  2,  3,  4,  5,   6,  7,  8,  9,  10, ...
  1,  4,  3,  8,  5,  12,  7, 16,  9,  20, ...
  1,  4,  9,  8,  5,  36,  7, 16, 27,  20, ...
  1,  8,  9, 16,  5,  72,  7, 32, 27,  40, ...
  1,  8,  9, 16, 25,  72,  7, 32, 27, 200, ...
  1,  8,  9, 16, 25,  72,  7, 32, 27, 200, ...
  1,  8,  9, 16, 25,  72, 49, 32, 27, 200, ...
  1, 16,  9, 32, 25, 144, 49, 64, 27, 400, ...
  1, 16, 27, 32, 25, 432, 49, 64, 81, 400, ...
  1, 16, 27, 32, 25, 432, 49, 64, 81, 400, ...
Example showing that T(4,4) = 16: for N == 0, 1, ..., 15 (mod 16), binomial(N,4) == {0, 0, 0, 0, 1, 1, 3, 3, 2, 2, 2, 2, 3, 3, 1, 1} (mod 4).
Example showing that T(3,10) = 20: for N == 0, 1, ..., 19 (mod 20), binomial(N,3) == {0, 0, 0, 1, 4, 0, 0, 5, 6, 4, 0, 5, 0, 6, 4, 5, 0, 0, 6, 9} (mod 10).
		

Crossrefs

Cf. A022998 (row n = 2), A385555 (row n = 3), A385556 (row n = 4), A385557 (rows n = 5 and 6), A385558 (row n = 7), A385559 (row n = 8), A385560 (rows n = 9 and 10).
Cf. A062383 (2nd column), A064235 (3rd column if offset 0), A385552 (5th column), A385553 (6th column), A385554 (10th column).
Cf. A349221.

Programs

  • Mathematica
    A349593[n_, k_] := If[n == 0 || k == 1, 1, k*Product[p^Floor[Log[p, n]], {p, FactorInteger[k][[All, 1]]}]];
    Table[A349593[k - 1, n - k + 2], {n, 0, 15}, {k, n + 1}] (* Paolo Xausa, Jul 07 2025 *)
  • PARI
    T(n,k) = if(n==0, 1, my(r=1, f=factor(k)); for(j=1, #f[, 1], my(p=f[j, 1], e=f[j, 2]); r *= p^(logint(n,p)+e)); return(r))

Formula

The n-th row is multiplicative with T(n,p^e) = 1 if n = 0, p^(e+floor(log(n)/log(p))) otherwise. In other words, for n > 0, T(n,k) = k * Product_{prime p|k} p^(floor(log(n)/log(p))). See my pdf file for a proof.

A080342 Number of weighings required to identify a single bad coin out of n coins, using a two-pan balance.

Original entry on oeis.org

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

Views

Author

Artemario Tadeu Medeiros da Silva (artemario(AT)uol.com.br), Mar 19 2003

Keywords

Comments

It is known that there is exactly one bad coin, which is heavier than the others. No weights are used in the weighings.
0 appears once, 1 twice, 2 6 times, 3 18 times, 4 54 times, ... which is the same as the number of base-3 numbers of length n; see A007089. - Jonathan Vos Post, Apr 20 2011
Records appear at positions 3^n+1 (=A034472(n)). - Robert G. Wilson v, Aug 06 2012
The "Heavy Marble" section of "Brainteaser Problems" in the Mongan et al. reference describes the n = 8 case in detail and then derives the general formula given below. Of course this sequence applies also when the single, unlike object is lighter than all the others. If the unlike object is only known to have a different weight (that is, to be lighter than all the others or heavier than all the others), use A064099. - Rick L. Shepherd, Sep 05 2013
If it is unknown whether the bad coin is heavier or lighter, then the minimum number of weighings is A029837(n) and the number of coins that must be used in the first weighing is A004526(n), for n > 2. - Ivan N. Ianakiev, Apr 13 2017

Examples

			a(1) = 0 since no weighings are needed - the coin is bad. a(2) = 1 since one weighing is needed.
		

References

  • J. Mongan, N. Suojanen, and E. Giguère, Programming Interviews Exposed: Secrets to Landing Your Next Job, 2nd Edition, Wiley Publishing, Inc., 2007, pp. 169-172.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a080342 n = genericIndex a080342_list (n - 1)
    a080342_list = 0 : zs where
       zs = 1 : 1 : (map (+ 1) $ concat $ transpose [zs, zs, zs])
    -- Reinhard Zumkeller, Sep 02 2015
  • Mathematica
    f[n_] := Floor[ Log[3, n]] - Floor[2^-FractionalPart[ Log[3, n]]] + 1; Array[f, 105] (* Robert G. Wilson v, Aug 05 2012 *)
  • PARI
    a(n) = ceil(log(n)/log(3)) \\ Rick L. Shepherd, Sep 05 2013
    

Formula

a(n) = floor(L) - floor(2^(-f(L))) + 1, where L = log_3(n) and f() = fractional part.
a(n) = ceiling(log_3(n)). - Rick L. Shepherd, Sep 05 2013
A064235(n) = 3 ^ a(n). - Reinhard Zumkeller, Sep 02 2015

A385552 Period of {binomial(N,n) mod 5: N in Z}.

Original entry on oeis.org

1, 5, 5, 5, 5, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125
Offset: 0

Views

Author

Jianing Song, Jul 03 2025

Keywords

Comments

a(n) is the smallest power of 5 > n. For the general result, see A349593.
Since the modulus (5) is a prime, the remainder of binomial(N,n) is given by Lucas's theorem.

Examples

			For N == 0, 1, ..., 24 (mod 5), binomial(N,5) == {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4} (mod 5).
		

Crossrefs

Column 5 of A349593. A062383, A064235 (if offset 0), A385553, and A385554 are respectively columns 2, 3, 6, and 10.

Programs

  • PARI
    a(n) = if(n, 5^(logint(n,5)+1), 1)
    
  • Python
    from sympy import integer_log
    def A385552(n): return 5*5**(integer_log(n,5)[0]) if n else 1 # Chai Wah Wu, Jul 06 2025

A385553 Period of {binomial(N,n) mod 6: N in Z}.

Original entry on oeis.org

1, 6, 12, 36, 72, 72, 72, 72, 144, 432, 432, 432, 432, 432, 432, 432, 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, 864, 2592, 2592, 2592, 2592, 2592, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184, 5184
Offset: 0

Views

Author

Jianing Song, Jul 03 2025

Keywords

Examples

			For N == 0, 1, ..., 35 (mod 36), binomial(N,3) == {0, 0, 0, 1, 4, 4, 2, 5, 2, 0, 0, 3, 4, 4, 4, 5, 2, 2, 0, 3, 0, 4, 4, 1, 2, 2, 2, 3, 0, 0, 4, 1, 4, 2, 2, 5} (mod 6).
For N == 0, 1, ..., 71 (mod 72), binomial(N,4) == {0, 0, 0, 0, 1, 5, 3, 5, 4, 0, 0, 0, 3, 1, 5, 3, 2, 4, 0, 0, 3, 3, 1, 5, 0, 2, 4, 0, 3, 3, 3, 1, 2, 0, 2, 4, 3, 3, 3, 3, 4, 2, 0, 2, 1, 3, 3, 3, 0, 4, 2, 0, 5, 1, 3, 3, 0, 0, 4, 2, 3, 5, 1, 3, 0, 0, 0, 4, 5, 3, 5, 1} (mod 6).
		

Crossrefs

Column 6 of A349593. A062383, A064235 (if offset 0), A385552, and A385554 are respectively columns 2, 3, 5, and 10.

Programs

  • PARI
    a(n) = if(n, (2^(logint(n,2)+1)) * (3^(logint(n,3)+1)), 1)

Formula

a(n) = (the smallest power of 2 > n) * (the smallest power of 3 > n) = A062383(n) * A064235(n+1). For the general result, see A349593.

A385554 Period of {binomial(N,n) mod 10: N in Z}.

Original entry on oeis.org

1, 10, 20, 20, 40, 200, 200, 200, 400, 400, 400, 400, 400, 400, 400, 400, 800, 800, 800, 800, 800, 800, 800, 800, 800, 4000, 4000, 4000, 4000, 4000, 4000, 4000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000
Offset: 0

Views

Author

Jianing Song, Jul 03 2025

Keywords

Examples

			For N == 0, 1, ..., 19 (mod 20), binomial(N,3) == {0, 0, 0, 1, 4, 0, 0, 5, 6, 4, 0, 5, 0, 6, 4, 5, 0, 0, 6, 9} (mod 10).
For N == 0, 1, ..., 39 (mod 40), binomial(N,4) == {0, 0, 0, 0, 1, 5, 5, 5, 0, 6, 0, 0, 5, 5, 1, 5, 0, 0, 0, 6, 5, 5, 5, 5, 6, 0, 0, 0, 5, 1, 5, 5, 0, 0, 6, 0, 5, 5, 5, 1} (mod 10).
		

Crossrefs

Column 10 of A349593. A062383, A064235 (if offset 0), A385552, and A385553 are respectively columns 2, 3, 5, and 6.

Programs

  • PARI
    a(n) = if(n, (2^(logint(n,2)+1)) * (5^(logint(n,5)+1)), 1)

Formula

a(n) = (the smallest power of 2 > n) * (the smallest power of 5 > n) = A062383(n) * A385552(n). For the general result, see A349593.

A105672 a(1)=1, then bracketing n with powers of 3 as f(t)=3^t for f(t) < n <= f(t+1), a(n) = f(t+1) - a(n-f(t)).

Original entry on oeis.org

1, 2, 1, 8, 7, 8, 1, 2, 1, 26, 25, 26, 19, 20, 19, 26, 25, 26, 1, 2, 1, 8, 7, 8, 1, 2, 1, 80, 79, 80, 73, 74, 73, 80, 79, 80, 55, 56, 55, 62, 61, 62, 55, 56, 55, 80, 79, 80, 73, 74, 73, 80, 79, 80, 1, 2, 1, 8, 7, 8, 1, 2, 1, 26, 25, 26, 19, 20, 19, 26, 25, 26, 1, 2, 1, 8, 7, 8, 1, 2, 1
Offset: 1

Views

Author

Benoit Cloitre, May 03 2005

Keywords

Crossrefs

Programs

  • Maple
    A105672 := proc(n)
            option remember;
            if n = 1 then
                    1;
            else
                    fn1 := A064235(n) ;
                    fn := fn1/3 ;
                    fn1-procname(n-fn) ;
            end if;
    end proc:
    seq(A105672(n),n=1..80) ; # R. J. Mathar, Nov 06 2011
  • Mathematica
    A064235[n_] := 3^Ceiling[Log[3, n]]; a[1] = 1; a[n_] := a[n] = A064235[n] - a[n - A064235[n]/3]; Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Jul 09 2013, after R. J. Mathar *)
  • PARI
    b(n,m)=if(n<2,1,m*m^floor(log(n-1)/log(m))-b(n-m^floor(log(n-1)/log(m)),m))

Formula

a(n+1) = 1 + Sum_{k=1..n} (-1)^k*(2-3*3^valuation(k, 3)).
a(n) = A064235(n) - a(n - A064235(n)/3). - R. J. Mathar, Nov 06 2011

A132171 3^n repeated 3^n times.

Original entry on oeis.org

1, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81
Offset: 0

Views

Author

Paul Curtz, Nov 04 2007

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a132171 n = genericIndex a132171_list n
    a132171_list = 1 : zs where
       zs = 3 : 3 : 3 : (map (* 3) $ concat $ transpose [zs, zs, zs])
    -- Reinhard Zumkeller, Sep 01 2015
    
  • Maple
    seq((3^n)$(3^n),n=0..5); # Robert Israel, Feb 24 2017
  • Mathematica
    Table[ConstantArray[3^n, 3^n], {n, 0, 4}] // Flatten (* or *)
    Table[3^Floor@ Log[3, 2 n + 1], {n, 0, 81}] (* Michael De Vlieger, Feb 24 2017 *)
  • Python
    from sympy import integer_log
    def A132171(n): return 3**integer_log((n<<1)+1,3)[0] # Chai Wah Wu, Nov 04 2024

Formula

From Robert Israel, Feb 24 2017: (Start)
a(n) = 3^floor(log_3(2n+1)).
a(3*n+1) = a(3*n+2) = a(3*n+3) = 3*a(n).
G.f.: (1-x)^(-1)*Sum_{m>=1} (3^m-3^(m-1))*x^((3^m-1)/2).
(End)
Sum_{n>=0} 1/a(n)^2 = 3/2. - Amiram Eldar, Aug 16 2022

A365458 The largest power of 3 that is less than or equal to n.

Original entry on oeis.org

1, 1, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 81, 81, 81, 81, 81
Offset: 1

Views

Author

Antti Karttunen, Sep 17 2023

Keywords

Examples

			a(2) = 1 because 3^0 = 1 <= 2.
a(3) = 3 because 3^1 = 3 <= 3.
a(4) = 3 because 3^1 = 3 <= 4.
		

Crossrefs

Programs

  • Mathematica
    Array[3^Floor@ Log[3, #] &, 90] (* Michael De Vlieger, Sep 17 2023 *)
  • PARI
    A365458(n) = if(1==n,n,my(k=0); while((3^k) < n, k++); if((3^k) > n,k--); (3^k));
    
  • PARI
    a(n) = 3^logint(n, 3); \\ Michel Marcus, Sep 17 2023
    
  • Python
    def A365458(n):
        kmin, kmax = 0, 1
        while 3**kmax <= n:
            kmax <<= 1
        while True:
            kmid = kmax+kmin>>1
            if 3**kmid > n:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        return 3**kmin # Chai Wah Wu, Sep 17 2023

Formula

a(n) = 3^floor((log n) / (log 3)). - Michael De Vlieger, Sep 17 2023
a(n) = A000244(A062153(n)). - Michel Marcus, Sep 17 2023

A349673 a(n) is the smallest positive integer m such that the set of numbers {f(k) : 1 <= k <= n} are pairwise distinct modulo m for f(x)=x^3+x.

Original entry on oeis.org

1, 3, 3, 9, 9, 9, 9, 9, 9, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81
Offset: 1

Views

Author

Michel Marcus, Nov 24 2021

Keywords

Comments

This is called the discriminator of f(x)=x^3+x.
First differs from A064235 at n=244.

Crossrefs

Cf. A064235.

Programs

  • Mathematica
    a[n_] := Module[{e1 = IntegerExponent[n-1, 3], e2 = IntegerExponent[n-2, 3], e = -1}, If[3^e1 == n - 1 && Mod[e1,6] == 5, e = e1 - 1]; If[3^e2 == n-2 && Mod[e2,6] == 5, e = e2 - 1];If[e > -1, 7*3^e, 3^Ceiling[Log[3,n]]]]; Array[a, 100] (* Amiram Eldar, Nov 24 2021 *)
  • PARI
    isok(n,m) = my(v=vector(n, k, (k^3+k)% m)); #v == #vecsort(v,,8);
    a(n) = my(m=1); while (!isok(n, m), m++); m;
    
  • PARI
    a(n) = {my(v); if ((n%3 == 1) && (n!=1), v=valuation(n-1,3); if ((3^v == n-1) && ((v%6)==5), return(7*3^(v-1)))); if ((n%3 == 2) && (n!=2), v=valuation(n-2,3); if ((3^v == n-2) && ((v%6)==5), return(7*3^(v-1)))); return(3^ceil(log(n)/log(3)));}

Formula

a(n) = 7*3^(6s+4) if n=3^(6s+5)+1 or n=3^(6s+5)+2; otherwise a(n) = 3^ceiling(log_3(n)) (see Theorem 1.1 in Yang & Zhao).
Showing 1-10 of 10 results.