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

A160700 a(n) = if n<16 then n else a(floor(n/16)) XOR (n mod 16).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13, 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, 4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11, 5, 4, 7, 6, 1, 0, 3, 2, 13
Offset: 0

Views

Author

Reinhard Zumkeller, Jun 01 2009

Keywords

Comments

A very simple hash function for the nonnegative integers.
a(A000079(n))=A133145(n); a(A000302(n))=A010685(n); a(A001025(n))=A161452(n); a(A161440(n))=0; a(A161441(n))=1; a(A161442(n))=2; a(A161443(n))=3; a(A161444(n))=4; a(A161445(n))=5; a(A161446(n))=6; a(A161447(n))=7; a(A161448(n))=8; a(A161449(n))=9; a(A161450(n))=10; a(A161451(n))=11; a(A161452(n))=12; a(A161453(n))=13; a(A161454(n))=14; a(A161455(n))=15. - Reinhard Zumkeller, Jun 10 2009

Programs

  • Haskell
    import Data.Bits (xor)
    a160700 n = a160700_list !! n
    a160700_list = [0..15] ++ map f [16..] where
       f x = a160700 x' `xor` m :: Int where (x', m) = divMod x 16
    -- Reinhard Zumkeller, Nov 07 2012
    
  • Maple
    read("transforms") ;
    A160700 := proc(n)
        if n < 16 then
            n;
        else
            XORnos(procname(floor(n/16)),modp(n,16))
        end if;
    end proc: # R. J. Mathar, Jul 12 2016
  • Mathematica
    a[n_] := a[n] = If[n < 16, n, a[Floor[n/16]] ~BitXor~ Mod[n, 16]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 25 2018 *)
  • Maxima
    load(functs)$
    A160700(n):=if n<16 then n else logxor(floor(n/16),mod(n,16))$
    makelist(A160700(n),n,0,60); /* Martin Ettl, Nov 05 2012 */
    
  • PARI
    a(n)=my(t=n%16); while(n>15, n>>=4; t=bitxor(t, n%16)); t \\ Charles R Greathouse IV, Jan 25 2018

A083593 Expansion of 1/((1-2*x)*(1-x^4)).

Original entry on oeis.org

1, 2, 4, 8, 17, 34, 68, 136, 273, 546, 1092, 2184, 4369, 8738, 17476, 34952, 69905, 139810, 279620, 559240, 1118481, 2236962, 4473924, 8947848, 17895697, 35791394, 71582788, 143165576, 286331153, 572662306, 1145324612, 2290649224
Offset: 0

Views

Author

Paul Barry, May 02 2003

Keywords

Comments

Here we let p = 4 to produce the above sequence, but p can be an arbitrary natural number. By letting p = 2, 3, 6, 7 we produce A000975, A033138, A195904 and A117302. We denote by U[p,n,m] the number of cases in which the first player gets killed in a Russian roulette game when p players use a gun with n chambers and m bullets. They never rotate the cylinder after the game starts. The chambers can be represented by the list {1,2,...,n}.
We are going to calculate the following (0), (1), ..., (t) separately. (0) The first player gets killed when one bullet is in the first chamber and the remaining m-1 bullets are in {2,3,...,n}. We have binomial(n-1,m-1) cases for this. (1) The first gets killed when one bullet is in the (p+1)th chamber and the rest of the bullets are in {p+2,...,n}. We have binomial(n-p-1,m-1) cases for this. We continue to calculate and the last is (t), where t = floor((n-m)/p). (t) The first gets killed when one bullet is in the (pt+1)-st chamber and the remaining bullets are in {pt+2,...,n}. We have binomial(n-pt-1,m-1) cases for this. Therefore U[p,n,m] = Sum_{z=0..floor((n-m)/p)} binomial(n-pz-1,m-1). Let A[p,n] be the number of the cases in which the first player gets killed when p players use a gun with n chambers and the number of the bullets can be from 1 to n. Then A[p,n] = Sum_{m=1..n} U[p,n,m]. - Ryohei Miyadera, Tomohide Hashiba, Yuta Nakagawa, Hiroshi Matsui, Jun 04 2006
A001045(n+5) without last digit. - Paul Curtz, Apr 21 2021
a(n) is the number of partitions of n into parts 1 and 4 where there are two colors of part 1 and the order of the colors of parts 1 matters. If the order of colors doesn't matter we get A001972. - Joerg Arndt, Jan 18 2024

Crossrefs

Programs

  • Mathematica
    U[p_,n_,m_,v_]:=Block[{t},t=Floor[(1+p-m+n-v)/p];Sum[Binomial[n-v-p*z,m-1],{z,0,t-1}]]; A[p_,n_,v_]:=Sum[U[p,n,k,v],{k,1,n}]; (* Here we let p = 4 to produce the above sequence, but this code can produce A000975, A033138, A195904, A117302 for p=2,3,6,7.*) Table[A[4,n,1], {n,1,20}] (* Ryohei Miyadera, Tomohide Hashiba, Yuta Nakagawa, Hiroshi Matsui, Jun 04 2006 *)
    CoefficientList[Series[1/((1-2x)(1-x^4)),{x,0,40}],x] (* Vincenzo Librandi, Apr 04 2012 *)
    a[n_] := FromDigits[Table[(Mod[j, 4]/4) // Round, {j, 1, n + 3}], 2] (* Andres Cicuttin, Mar 25 2016 *)
    a[n_] := a[n] = 2 a[n - 1] + 1 - Ceiling[Mod[n, 4]/4]; a[0] = 1;
    Table[a[n], {n, 0, 31}] (* Andres Cicuttin, Mar 27 2016 *)
    LinearRecurrence[{2,0,0,1,-2},{1,2,4,8,17},40] (* Harvey P. Dale, Apr 03 2018 *)
  • PARI
    Vec(1/((1-2*x)*(1-x^4))+O(x^99)) \\ Charles R Greathouse IV, May 15 2013
    
  • PARI
    a(n)=(16<Charles R Greathouse IV, Mar 27 2016
    
  • Python
    def A083593(n): return ((32<Chai Wah Wu, Apr 25 2025

Formula

a(n) = 2*a(n-1) + a(n-4) - 2*a(n-5).
If n is a multiple of 4, then a(n) = 2*a(n-1) + 1, otherwise a(n) = 2*a(n-1). - Gerald McGarvey, Oct 14 2008
a(n) = floor((2^(n+5) + 1)/30). - Tani Akinari, Jul 09 2013
From Andres Cicuttin, Mar 29 2016: (Start)
a(n) = 2*a(n-1) + floor(((n-1) mod 4)/3), with a(0)=1.
a(n) = 2*a(n-1) + 1 - ceiling((n mod 4)/4), with a(0)=1. (End)
15*a(n) = 2^(n+4) - A133145(n). - R. J. Mathar, Feb 27 2019
E.g.f.: (3*cos(x) - 5*cosh(x) + 32*cosh(2*x) + 6*sin(x) - 10*sinh(x) + 32*sinh(2*x))/30. - Stefano Spezia, Apr 25 2025

A191497 a(n+1) = 2*a(n) + A014017(n+5), a(0) = 0.

Original entry on oeis.org

0, 0, 0, 0, 1, 2, 4, 8, 15, 30, 60, 120, 241, 482, 964, 1928, 3855, 7710, 15420, 30840, 61681, 123362, 246724, 493448, 986895, 1973790, 3947580, 7895160, 15790321, 31580642, 63161284, 126322568, 252645135
Offset: 0

Views

Author

Paul Curtz, Jun 03 2011

Keywords

Crossrefs

Programs

Formula

a(n+4) = 2^n - a(n).
a(n) = 2*a(n-1) - a(n-4) + 2*a(n-5).
a(4*n+4) = 16*a(4*n) + (-1)^n.
From R. J. Mathar, Jun 23 2011: (Start)
G.f.: -x^4 / ((2*x-1)*(x^4+1)).
a(n) = (2^n - (-1)^floor(n/4)*A133145(n))/17. (End)
Showing 1-3 of 3 results.