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-6 of 6 results.

A220466 a((2*n-1)*2^p) = 4^p*(n-1) + 2^(p-1)*(1+2^p), p >= 0 and n >= 1.

Original entry on oeis.org

1, 3, 2, 10, 3, 7, 4, 36, 5, 11, 6, 26, 7, 15, 8, 136, 9, 19, 10, 42, 11, 23, 12, 100, 13, 27, 14, 58, 15, 31, 16, 528, 17, 35, 18, 74, 19, 39, 20, 164, 21, 43, 22, 90, 23, 47, 24, 392, 25, 51, 26, 106, 27, 55, 28, 228, 29, 59, 30, 122, 31, 63, 32, 2080, 33, 67, 34, 138, 35
Offset: 1

Views

Author

Johannes W. Meijer, Dec 24 2012

Keywords

Comments

The a(n) appeared in the analysis of A220002, a sequence related to the Catalan numbers.
The first Maple program makes use of a program by Peter Luschny for the calculation of the a(n) values. The second Maple program shows that this sequence has a beautiful internal structure, see the first formula, while the third Maple program makes optimal use of this internal structure for the fast calculation of a(n) values for large n.
The cross references lead to sequences that have the same internal structure as this sequence.

Crossrefs

Cf. A000027 (the natural numbers), A000120 (1's-counting sequence), A000265 (remove 2's from n), A001316 (Gould's sequence), A001511 (the ruler function), A003484 (Hurwitz-Radon numbers), A003602 (a fractal sequence), A006519 (highest power of 2 dividing n), A007814 (binary carry sequence), A010060 (Thue-Morse sequence), A014577 (dragon curve), A014707 (dragon curve), A025480 (nim-values), A026741, A035263 (first Feigenbaum symbolic sequence), A037227, A038712, A048460, A048896, A051176, A053381 (smooth nowhere-zero vector fields), A055975 (Gray code related), A059134, A060789, A060819, A065916, A082392, A085296, A086799, A088837, A089265, A090739, A091512, A091519, A096268, A100892, A103391, A105321 (a fractal sequence), A109168 (a continued fraction), A117973, A129760, A151930, A153733, A160467, A162728, A181988, A182241, A191488 (a companion to Gould's sequence), A193365, A220466 (this sequence).

Programs

  • Haskell
    -- Following Ralf Stephan's recurrence:
    import Data.List (transpose)
    a220466 n = a006519_list !! (n-1)
    a220466_list = 1 : concat
       (transpose [zipWith (-) (map (* 4) a220466_list) a006519_list, [2..]])
    -- Reinhard Zumkeller, Aug 31 2014
  • Maple
    # First Maple program
    a := n -> 2^padic[ordp](n, 2)*(n+1)/2 : seq(a(n), n=1..69); # Peter Luschny, Dec 24 2012
    # Second Maple program
    nmax:=69: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := 4^p*(n-1)  + 2^(p-1)*(1+2^p) od: od: seq(a(n), n=1..nmax);
    # Third Maple program
    nmax:=69: for p from 0 to ceil(simplify(log[2](nmax))) do n:=2^p: n1:=1: while n <= nmax do a(n) := 4^p*(n1-1)+2^(p-1)*(1+2^p): n:=n+2^(p+1): n1:= n1+1: od: od:  seq(a(n), n=1..nmax);
  • Mathematica
    A220466 = Module[{n, p}, p = IntegerExponent[#, 2]; n = (#/2^p + 1)/2; 4^p*(n - 1) + 2^(p - 1)*(1 + 2^p)] &; Array[A220466, 50] (* JungHwan Min, Aug 22 2016 *)
  • PARI
    a(n)=if(n%2,n\2+1,4*a(n/2)-2^valuation(n/2,2)) \\ Ralf Stephan, Dec 17 2013
    

Formula

a((2*n-1)*2^p) = 4^p*(n-1) + 2^(p-1)*(1+2^p), p >= 0 and n >= 1. Observe that a(2^p) = A007582(p).
a(n) = ((n+1)/2)*(A060818(n)/A060818(n-1))
a(n) = (-1/64)*(q(n+1)/q(n))/(2*n+1) with q(n) = (-1)^(n+1)*2^(4*n-5)*(2*n)!*A060818(n-1) or q(n) = (1/8)*A220002(n-1)*1/(A098597(2*n-1)/A046161(2*n))*1/(A008991(n-1)/A008992(n-1))
Recurrence: a(2n) = 4a(n) - 2^A007814(n), a(2n+1) = n+1. - Ralf Stephan, Dec 17 2013

A002472 Number of pairs x,y such that y-x=2, (x,n)=1, (y,n)=1 and 1 <= x <= n.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 5, 4, 3, 3, 9, 2, 11, 5, 3, 8, 15, 3, 17, 6, 5, 9, 21, 4, 15, 11, 9, 10, 27, 3, 29, 16, 9, 15, 15, 6, 35, 17, 11, 12, 39, 5, 41, 18, 9, 21, 45, 8, 35, 15, 15, 22, 51, 9, 27, 20, 17, 27, 57, 6, 59, 29, 15, 32, 33, 9, 65, 30, 21, 15, 69, 12, 71, 35, 15, 34, 45, 11, 77, 24, 27
Offset: 1

Views

Author

Keywords

Comments

This is the function phi(n, 2) defined in Alder. - Michel Marcus, Nov 14 2017

Examples

			For n = 4, the condition gcd(x,4) = gcd(x+2,4) = 1 is satisfied by exactly two positive integers x not exceeding n, namely, by x = 1 and x = 3. Therefore a(4) = 2.
		

References

  • V. A. Golubev, Sur certaines fonctions multiplicatives et le problème des jumeaux. Mathesis 67 (1958), 11-20.
  • V. A. Golubev, Nombres de Mersenne et caractères du nombre 2. Mathesis 67 (1958), 257-262.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000010 (phi(n,0)), A058026 (phi(n,1)), A065474.
Similar generalizations of Euler's totient for prime k-tuples: this sequence (k=2), A319534 (k=3), A319516 (k=4), A321029 (k=5), A321030 (k=6).

Programs

  • Haskell
    a002472 n = length [x | x <- [1..n], gcd n x == 1, gcd n (x + 2) == 1]
    -- Reinhard Zumkeller, Mar 23 2012
  • Maple
    with(numtheory): seq(add(mobius(d)*phi(2*n)/phi(2*d), d in divisors(n)), n=1..100); # Ridouane Oudra, Aug 20 2024
  • Mathematica
    a[n_] := If[ Head[ r=Reduce[ GCD[x, n] == 1 && GCD[x+2, n] == 1 && 1 <= x <= n, x, Integers]] === Or, Length[r], 1]; Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Nov 22 2011 *)
    (* Second program (5 times faster): *)
    a[n_] := Sum[Boole[GCD[n, x] == 1 && GCD[n, x+2] == 1], {x, 1, n}];
    Array[a, 81] (* Jean-François Alcover, Jun 19 2018, after Michel Marcus *)
    f[p_, e_] := If[p == 2, p^(e-1), (p-2)*p^(e-1)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Jan 22 2020 *)
  • PARI
    a(n)=my(k=valuation(n,2),f=factor(n>>k));prod(i=1,#f[,1],(f[i,1]-2)*f[i,1]^(f[i,2]-1))<Charles R Greathouse IV, Nov 22 2011
    
  • PARI
    a(n) = sum(x=1, n, (gcd(n,x) == 1) && (gcd(n, x+2) == 1)); \\ Michel Marcus, Nov 14 2017
    

Formula

Multiplicative with a(p^e) = p^(e-1) if p = 2; (p-2)*p^(e-1) if p > 2. - David W. Wilson, Aug 01 2001
a(n) = Sum_{k=1..n} [GCD(2*n-k,n) * GCD(k+2,n) = 1], where [ ] is the Iverson bracket. - Wesley Ivan Hurt, Sep 29 2021
Sum_{k=1..n} a(k) ~ c * n^2, where c = (3/4) * Product_{p prime} (1 - 2/p^2) = (3/4) * A065474 = 0.2419755742... . - Amiram Eldar, Oct 23 2022
From Ridouane Oudra, Aug 20 2024: (Start)
a(n) = phi(2*n) * Sum_{d|n} mu(d)/phi(2*d).
a(n) = - phi(n) * Sum_{d|n} mu(2*d)/phi(d).
a(n) = A160467(n)*A058026(A000265(n)).
a(2*n+1) = A070554(n).
a(2^m*(2*n+1)) = 2^(m-1)*A070554(n), with m>0. (End)

Extensions

More terms from David W. Wilson

A140670 a(n) = 1 if n is odd; otherwise, a(n) = 2^k - 1 where 2^k is the largest power of 2 that divides n.

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 3, 1, 1, 1, 15, 1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 3, 1, 1, 1, 31, 1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 3, 1, 1, 1, 15, 1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 3, 1, 1, 1, 63, 1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 3, 1, 1, 1, 15, 1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 3, 1, 1, 1, 31, 1, 1, 1, 3, 1, 1
Offset: 1

Views

Author

Michael Somos, May 21 2008

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := If[OddQ[n], 1, 2^IntegerExponent[n, 2] - 1]; Array[a, 100] (* Amiram Eldar, Oct 22 2022 *)
  • PARI
    {a(n) = if(n==0, 0, if(n%2, 1, 2^valuation(n, 2) - 1))}
    
  • Python
    def A140670(n): return max(1,(n&-n)-1) # Chai Wah Wu, Jul 08 2022

Formula

a(n) is multiplicative with a(2^e) = 2^e - 1 if e > 0, a(p^e) = 1 if p > 2.
a(2*n + 1) = 1. a(-n) = a(n). a(2*n) = 2 * a(n) + (-1)^n unless n=0.
Dirichlet g.f.: zeta(s)*(1+2^(1-2s)-2^(1-s))/(1-2^(1-s)). - R. J. Mathar, Feb 07 2011
a(n) = (2*A160467(n))-1. - Antti Karttunen, Nov 18 2017
Sum_{k=1..n} a(k) ~ (1/(2*log(2))) * (n*log(n) + (gamma + log(2)/2 - 1) * n), where gamma is Euler's constant (A001620). - Amiram Eldar, Oct 22 2022
a(n) = A006519(n) - A059841(n). - Ridouane Oudra, Jul 30 2025

A160466 Row sums of the Eta triangle A160464.

Original entry on oeis.org

-1, -9, -87, -2925, -75870, -2811375, -141027075, -18407924325, -1516052821500, -153801543183750, -18845978136851250, -2744283682352086875, -468435979952504313750, -92643070481933918821875
Offset: 2

Views

Author

Johannes W. Meijer, May 24 2009

Keywords

Comments

It is conjectured that the row sums of the Eta triangle depend on five different sequences.
Two Maple algorithms are given. The first one gives the row sums according to the Eta triangle A160464 and the second one gives the row sums according to our conjecture.

Crossrefs

A160464 is the Eta triangle.
Row sum factors A119951, A000466, A043529, A045896 and A160467.

Programs

  • Maple
    nmax:=15; c(2) := -1/3: for n from 3 to nmax do c(n):=(2*n-2)*c(n-1)/(2*n-1)-1/ ((n-1)*(2*n-1)) end do: for n from 2 to nmax do GCS(n-1) := ln(1/(2^(-(2*(n-1)-1-floor(ln(n-1)/ ln(2))))))/ln(2); p(n):=2^(-GCS(n-1))*(2*n-1)!; ETA(n, 1) := p(n)*c(n) end do: mmax:=nmax: for m from 2 to mmax do ETA(2, m) := 0 end do: for n from 3 to nmax do for m from 2 to mmax do q(n) := (1+(-1)^(n-3)*(floor(ln(n-1)/ln(2)) - floor(ln(n-2)/ln(2)))): ETA(n, m) := q(n)*(-ETA(n-1, m-1)+(n-1)^2*ETA(n-1, m)) end do end do: for n from 2 to nmax do s1(n):=0: for m from 1 to n-1 do s1(n) := s1(n) + ETA(n, m) end do end do: seq(s1(n), n=2..nmax);
    # End first program.
    nmax:=nmax; A160467 := proc(n): denom(4*(4^n-1)*bernoulli(2*n)/n) end: A043529 := proc(n): ceil(frac(log[2](n+1))+1) end proc: A000466 := proc(n): 4*n^2-1 end proc: A045896 := proc(n): denom((n)/((n+1)*(n+2))) end proc: A119951 := proc(n) : numer(sum(((2*k1)!/(k1!*(k1+1)!))/2^(2*(k1-1)), k1=1..n)) end proc: for n from 1 to nmax do SF(2*n+1):= A000466(n)/A043529(n-1); SF(2*n+2) := A045896(n-1)/A160467(n+1) end do: FF(2):=1: for n from 3 to nmax do FF(n) := SF(n) * FF(n-1) end do: for n from 2 to nmax do s2(n):= (-1)*A119951(n-1)*FF(n) end do: seq(s2(n), n=2..nmax);
    # End second program.

Formula

Rowsums(n) = (-1) * A119951(n-1) * FF(n) for n >= 2.
FF(n) = SF(n) * FF(n-1) for n >= 3 with FF(2) =1.
SF(2*n) = A045896(n-2) / A160467(n) for n >= 2.
SF(2*n+1) = A000466(n) / A043529(n-1) for n >= 1.

A259445 Multiplicative with a(n) = n if n is odd and a(2^s)=2.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 7, 2, 9, 10, 11, 6, 13, 14, 15, 2, 17, 18, 19, 10, 21, 22, 23, 6, 25, 26, 27, 14, 29, 30, 31, 2, 33, 34, 35, 18, 37, 38, 39, 10, 41, 42, 43, 22, 45, 46, 47, 6, 49, 50, 51, 26, 53, 54, 55, 14, 57, 58, 59, 30, 61, 62, 63, 2, 65, 66, 67, 34
Offset: 1

Views

Author

Keywords

Comments

If n = 2^s*m with m odd and s > 0 then a(n) = 2*m.

Crossrefs

Programs

  • Maple
    A259445 := proc(n::integer)
        local a, pe, p,e ;
        a := 1 ;
        for pe in ifactors(n)[2] do
            p := op(1,pe) ;
            e := op(2,pe) ;
            if p = 2 then
                a := 2*a ;
            else
                a := a*p^e  ;
            end if;
        end do:
        a;
    end proc:
    seq(A259445(n),n=1..80) ; # R. J. Mathar, Feb 21 2025
  • Mathematica
    G[n_] := If[Mod[n, 2] == 0, n/2^(FactorInteger[n][[1, 2]] - 1), n]; Table[G[n], {n, 1, 70}]
  • PARI
    a(n)=n>>max(valuation(n,2)-1,0) \\ Charles R Greathouse IV, Jun 28 2015

Formula

From Peter Bala, Feb 21 2019: (Start)
a(n) = n*gcd(n,2)/gcd(n,2^n).
a(2*n) = 2*A000265(2*n); a(2*n+1) = A000265(2*n+1).
O.g.f.: x*(1 + 4*x + x^2)/(1 - x^2)^2 - 2*( F(x^2) + F(x^4) + F(x^8) + ... ), where F(x) = x/(1 - x)^2.
O.g.f. for reciprocals: Sum_{n >= 1} (1/a(n))*x^n = (3/4)*L(x) - (1/4)*L(-x) + (1/4)*( L(x^2) + L(x^4) + L(x^8) + ... ), where L(x) = log(1/(1 - x)).
(End)
From Peter Bala, Mar 09 2019: (Start)
a(n) = (-1)^(n+1)*Sum_ {d divides n} (-1)^(d+n/d)*phi(d), where phi(n) = A000010(n) is the Euler totient function. Cf. the identity n = Sum_ {d divides n} phi(d). Cf. A046897 and A321558.
O.g.f.: Sum_{n >= 1} phi(n)*x^n/(1 + (-x)^n). (End)
From Amiram Eldar, Nov 28 2022: (Start)
Dirichlet g.f.: zeta(s-1)*(1 + 1/2^(s-1) - 2/(2^s-1)).
Sum_{k=1..n} a(k) ~ (5/12) * n^2. (End)
a(n) = n /A160467(n). - R. J. Mathar, Feb 21 2025

A227577 Square array read by antidiagonals, A(n,k) the numerators of the elements of the difference table of the Euler polynomials evaluated at x=1, for n>=0, k>=0.

Original entry on oeis.org

1, -1, 1, 0, -1, 0, 1, 1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 1, 1, 1, 0, -1, -1, -5, -1, -1, 0, 17, 17, 13, 5, -5, -13, -17, -17, 0, 17, 17, 47, 13, 47, 17, 17, 0, -31, -31, -107, -73, -13, 13, 73, 107, 31, 31, 0, -31, -31, -355
Offset: 0

Views

Author

Paul Curtz, Jul 16 2013

Keywords

Comments

The difference table of the Euler polynomials evaluated at x=1:
1, 1/2, 0, -1/4, 0, 1/2, 0, -17/8, ...
-1/2, -1/2, -1/4, 1/4, 1/2, -1/2, -17/8, 17/8, ...
0, 1/4, 1/2, 1/4; -1, -13/8, 17/4, 107/8, ...
1/4, 1/4, -1/4, -5/4, -5/8, 47/8, 73/8, -355/8, ...
0, -1/2, -1, 5/8 13/2, 13/4, -107/2, -655/8, ...
-1/2, -1/2, 13/8, 47/8, -13/4, -227/4, -227/8, 5687/8, ...
0, 17/8, 17/4, -73/8, -107/2, 227/8, 2957/4, 2957/8, ...
17/8, 17/8, -107/8, -355/8, 655/8, 5687/8, -2957/8, -107125/8, ...
To compute the difference table, take
1, 1/2;
-1/2;
The next term is always half of the sum of the antidiagonals. Hence (-1/2 + 1/2 = 0)
1, 1/2, 0;
-1/2, -1/2;
0;
The first column (inverse binomial transform) lists the numbers (1, -1/2, 0, 1/4, ..., not in the OEIS; corresponds to A027641/A027642). See A209308 and A060096.
A198631(n)/A006519(n+1) is an autosequence. See A181722.
Note the main diagonal: 1, -1/2, 1/2, -5/4, 13/2, -227/4, 2957/4, -107125/8, .... (See A212196/A181131.)
This twice the first upper diagonal. The autosequence is of the second kind.
From 0, -1, the algorithm gives A226158(n), full Genocchi numbers, autosequence of the first kind.
The difference table of the Bernoulli polynomials evaluated at x=1 is (apart from signs) A085737/A085738 and its analysis by Ludwig Seidel was discussed in the Luschny link. - Peter Luschny, Jul 18 2013

Examples

			Read by antidiagonals:
    1;
  -1/2,  1/2;
    0,  -1/2,   0;
   1/4,  1/4, -1/4, -1/4;
    0,   1/4,  1/2,  1/4,   0;
  -1/2, -1/2, -1/4,  1/4,  1/2,  1/2;
    0,  -1/2, - 1,  -5/4,  -1,  -1/2,   0;
  ...
Row sums: 1, 0, -1/2, 0, 1, 0, -17/4, 0, ... = 2*A198631(n+1)/A006519(n+2).
Denominators: 1, 1, 2, 1, 1, 1, 4, 1, ... = A160467(n+2)?
		

Crossrefs

Programs

  • Maple
    DifferenceTableEulerPolynomials := proc(n) local A,m,k,x;
    A := array(0..n,0..n); x := 1;
    for m from 0 to n do for k from 0 to n do A[m,k]:= 0 od od;
    for m from 0 to n do A[m,0] := euler(m,x);
       for k from m-1 by -1 to 0 do
          A[k,m-k] := A[k+1,m-k-1] - A[k,m-k-1] od od;
    LinearAlgebra[Transpose](convert(A, Matrix)) end:
    DifferenceTableEulerPolynomials(7);  # Peter Luschny, Jul 18 2013
  • Mathematica
    t[0, 0] = 1; t[0, k_] := EulerE[k, 1]; t[n_, 0] := -t[0, n]; t[n_, k_] := t[n, k] = t[n-1, k+1] - t[n-1, k]; Table[t[n-k, k] // Numerator, {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jul 18 2013 *)
  • Sage
    def DifferenceTableEulerPolynomialsEvaluatedAt1(n) :
        @CachedFunction
        def ep1(n):          # Euler polynomial at x=1
            if n < 2: return 1 - n/2
            s = add(binomial(n,k)*ep1(k) for k in (0..n-1))
            return 1 - s/2
        T = matrix(QQ, n)
        for m in range(n) :  # Compute difference table
            T[m,0] = ep1(m)
            for k in range(m-1,-1,-1) :
                T[k,m-k] = T[k+1,m-k-1] - T[k,m-k-1]
        return T
    def A227577_list(m):
        D = DifferenceTableEulerPolynomialsEvaluatedAt1(m)
        return [D[k,n-k].numerator() for n in range(m) for k in (0..n)]
    A227577_list(12)  # Peter Luschny, Jul 18 2013

Extensions

Corrected by Jean-François Alcover, Jul 17 2013
Showing 1-6 of 6 results.