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.

User: Federico Provvedi

Federico Provvedi's wiki page.

Federico Provvedi has authored 4 sequences.

A382865 Bitwise XOR of all integers between n and 2n (endpoints included).

Original entry on oeis.org

0, 3, 5, 4, 8, 15, 13, 8, 16, 27, 21, 28, 24, 23, 29, 16, 32, 51, 37, 52, 40, 63, 45, 56, 48, 43, 53, 44, 56, 39, 61, 32, 64, 99, 69, 100, 72, 111, 77, 104, 80, 123, 85, 124, 88, 119, 93, 112, 96, 83, 101, 84, 104, 95, 109, 88, 112, 75, 117, 76, 120, 71, 125, 64, 128, 195
Offset: 0

Author

Federico Provvedi, May 21 2025

Keywords

Examples

			a(3) = 3 XOR 4 XOR 5 XOR 6 = 4, in binary representation is: ((011 XOR 100) XOR 101) XOR 110 = (111 XOR 101) XOR 110 = 010 XOR 110 = 100 (4 in decimal).
		

Programs

  • Maple
    a:= proc(n) option remember; uses Bits; `if`(n=0, 0,
          Xor(Xor(Xor(a(n-1), n-1), 2*n-1), 2*n))
        end:
    seq(a(n), n=0..65);  # Alois P. Heinz, May 26 2025
  • Mathematica
    a[n_] = BitXor[BitOr[n-1, 2] - (-1)^n*(n-1), 4*n]/2; Table[a[n],{n,0, 65}]
  • PARI
    a(n) = my(b=n); for (i=n+1, 2*n, b = bitxor(b, i)); b; \\ Michel Marcus, May 25 2025
    
  • Python
    def A382865(n): return [0, n, 1, n-1][n%4] ^ (2*n) # Karl-Heinz Hofmann, May 26 2025

Formula

a(2n) = A047615(n+1), and for every integer k>1: a(n*2^k -1) = 2^k * A065621(n).
a(4n) = 8*n, a(4n+1) = 2*A114389(n+1) + 1, a(4n+2) = 8*n + 5, a(4n+3) = 4*A065621(n+1).
From Karl-Heinz Hofmann, May 27 2025: (Start)
For all n == 0 (mod 4) --> a(n) = A005843(n) = 2*n
For all n == 1 (mod 4) --> a(n) = A048724(n)
For all n == 2 (mod 4) --> a(n) = A005408(n) = 2*n + 1
For all n == 3 (mod 4) --> a(n) = A048724(n) - 1 (End)
a(n) = (1/2) * XOR(A174091(n-1) - A181983(n-1), 4*n). - Federico Provvedi, May 31 2025

A371902 Positive integers whose binary form follows the periodic pattern 1101110: the concatenation of halftones 2 2 1 2 2 2 1, diminished by one, between successive pitches in the Ionian Major Scale.

Original entry on oeis.org

1, 3, 6, 13, 27, 55, 110, 221, 443, 886, 1773, 3547, 7095, 14190, 28381, 56763, 113526, 227053, 454107, 908215, 1816430, 3632861, 7265723, 14531446, 29062893, 58125787, 116251575, 232503150, 465006301, 930012603, 1860025206, 3720050413
Offset: 1

Author

Federico Provvedi, Apr 13 2024

Keywords

Comments

The periodic binary digits of 55/107 is the pattern sequence A291454(n)-1 which is the new bit introduced into a(n): a(n+1) = 2*a(n) + A291454(n) - 1.

Examples

			For n=10, playing 10 + 1 = 11 notes of the major scale (in Ionian mode), the 10 intervals between the pitches C D E F G A B C' D' E' F' expressed in halftones are 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, whose values diminished by one give the binary form '1101110110', which in decimal is 886, hence a(10) = 886.
		

Crossrefs

Programs

  • Mathematica
    Floor[110/127*2^Range[50]] (* Paolo Xausa, Jun 21 2024 *)

Formula

a(n) = floor((110/127)*2^n).
D.g.f.: z^2*(z^5 + z^4 + z^2 + z + 1)/((2 - z) (1 - z^7)) = z * Dgf(A000225) * Dgf(A234046).
G.f.: x*(1 + x + x^3 + x^4 + x^5)/((1 - 2*x)*(1 - x^7)). - Stefano Spezia, May 04 2024

A347365 a(n) = n * (2-(-1)^n), or zero together with first differences of even triangular numbers halved (A074378).

Original entry on oeis.org

0, 3, 2, 9, 4, 15, 6, 21, 8, 27, 10, 33, 12, 39, 14, 45, 16, 51, 18, 57, 20, 63, 22, 69, 24, 75, 26, 81, 28, 87, 30, 93, 32, 99, 34, 105, 36, 111, 38, 117, 40, 123, 42, 129, 44, 135, 46, 141, 48, 147, 50, 153, 52, 159, 54, 165, 56, 171, 58, 177, 60, 183, 62, 189, 64
Offset: 0

Author

Federico Provvedi, Aug 29 2021

Keywords

Comments

This sequence and A165998 form a complementary pair as solutions of alternating sequences a(n) + b(n) = 4*n (A008586), and a(n)*b(n) = 3*n^2 (A033428).
This is the particular case of the two integer sequences x(n)=2n and y(n)=n, where more generally, x(n) + y(n) = 2*a(n) and x(n)*y(n) = (a(n) + b(n)) * (a(n) - b(n)) give the two conjugate binomials a(n) = x(n) + (-1)^n*y(n) and b(n) = x(n) - (-1)^n*y(n) as solutions over the integer domain.
a(n) is also A005843 and A016945 interleaved.
For every integer k: a(n*k) = n*k is multiplicative for nonnegative even integers n and a(n*k) = n*a(k) for nonnegative odd integers n.
For every nonnegative odd integer k, the k-th difference of a(k*n)/k = (2n+1)*(-1)^n + 2 = A166519(n), and 1 for all nonnegative even integers.
a(6n+1)/3 = 6n+1, and a(6n+5)/3 = 6n+5, related to Collatz Conjecture.
Half-periods of a(k) mod n is A026741(n).

Programs

  • Mathematica
    Table[n(2-(-1)^n),{n,0,99}] (* or *)
    LinearRecurrence[{0,2,0,-1}, {0,3,2,9}, 100] (* or *)
    If[EvenQ@#,#,3#]&/@Range[0,99]  (* or *)
    Drop[Flatten@Transpose[{2#,6#+3}&@Range[0,Quotient[#,2]]],-Boole@EvenQ@#]&@(10^2)
  • PARI
    a(n) = n*(2-(-1)^n); \\ Michel Marcus, Sep 13 2021
  • Sage
    (x*(3+2*x+3*x^2)/(1-x^2)^2).series(x,65).coefficients(x,sparse=False) # Stefano Spezia, Aug 30 2021
    

Formula

G.f.: x*(3 + 2*x + 3*x^2)/(1 - x^2)^2.
E.g.f.: x*(3*cosh(x) + sinh(x)).
Dirichlet g.f.: 2^(-s) * (3*2^s - 4) * zeta(s-1) = (3 - 4/2^s) * zeta(s-1) = (3 - 1/2^(s-2)) * zeta(s-1).
a(n) = n*(2-(-1)^n) = 3*n / (2+(-1)^n).
a(n) = 3*n if n odd, a(n) = n if n even, implies a(a(2n)) = 2n, a(a(2n+1)) = 9*a(2n+1).
a(n) = 3*b(n), if n odd and a(n) = b(n)/3, if n even, with b(n) = A165998(n).
a(n) = a(a(2k*n)/(2k)) = a((2k+1)*n) / (2k+1), since a(2*k*n) / (2*k) = n.
a(n) = 4*n - A165998(n).
a(n+1) = a(n) + A086970(n+1)*(-1)^n.
a(n) = 2*A014682(n) - A000035(n).
a(n) = n*A010684(n). - Michel Marcus, Sep 13 2021
For positive integers k and n, a(n) = A(n,1) = n * (A(n,k)/n)^(1/k), where the k-th nesting composition A(n,k) = a(a(...a(a(n))...)) = n * ( a(n) / n )^k, and d.g.f. of A(n,k) = (2^(1-s) + (1-2^(1-s))*3^k) * zeta(s-1). - Federico Provvedi, Sep 18 2021
a(n+1) = A165998(n)*(1 + 1/n). - Federico Provvedi, Sep 19 2021

A258934 Half the difference between the 2n-th prime and the n-th prime, starting from n=2.

Original entry on oeis.org

2, 4, 6, 9, 12, 13, 17, 19, 21, 24, 26, 30, 32, 33, 39, 40, 45, 48, 51, 54, 57, 58, 67, 66, 69, 74, 78, 81, 84, 83, 90, 90, 99, 100, 104, 108, 110, 115, 118, 121, 126, 126, 132, 133, 140, 140, 140, 147, 156, 162, 165, 168, 171, 172, 175, 175, 185, 185, 189
Offset: 2

Author

Federico Provvedi, Jun 15 2015

Keywords

Comments

The differences between odd prime numbers are always even, so a(n) is well defined for n>=2.

Crossrefs

Programs

  • Magma
    [(NthPrime(2*n)-NthPrime(n))/2: n in [2..60]]; // Bruno Berselli, Jun 15 2015
  • Mathematica
    Table[(Prime[2 k] - Prime[k])/2, {k, 2, 60}]
  • Sage
    [(nth_prime(2*n)-nth_prime(n))/2 for n in (2..60)] # Bruno Berselli, Jun 15 2015
    

Formula

a(n) = ( prime(2*n) - prime(n) ) / 2.
a(n) = A072473(n)/2.