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

A020950 a(n) = k-1, where k is smallest number such that A002487(k) = n.

Original entry on oeis.org

0, 2, 4, 8, 10, 32, 18, 20, 34, 38, 36, 44, 42, 68, 72, 92, 76, 74, 82, 188, 84, 140, 138, 152, 150, 146, 154, 266, 148, 164, 172, 278, 274, 170, 282, 314, 276, 536, 324, 296, 292, 578, 300, 308, 364, 332, 298, 566, 330, 338, 552, 548, 562, 1274, 340, 584, 564, 614, 628
Offset: 1

Views

Author

Keywords

Examples

			A002487(33) = 6 and this is the first time 6 appears, so a(6) = 33-1 = 32.
		

Crossrefs

Programs

  • Python
    from itertools import count
    from functools import reduce
    def A020950(n): return next(filter(lambda k:sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(k)[-1:2:-1],(1,0)))==n,count(1)))-1 # Chai Wah Wu, May 05 2023

Extensions

Corrected and extended by David W. Wilson

A020943 a(2n+1) = |a(2n) - a(2n-1)|, a(2n) = a(n) + a(n-1).

Original entry on oeis.org

0, 1, 1, 1, 0, 2, 2, 2, 0, 1, 1, 2, 1, 4, 3, 4, 1, 2, 1, 1, 0, 2, 2, 3, 1, 3, 2, 5, 3, 7, 4, 7, 3, 5, 2, 3, 1, 3, 2, 2, 0, 1, 1, 2, 1, 4, 3, 5, 2, 4, 2, 4, 2, 5, 3, 7, 4, 8, 4, 10, 6, 11, 5, 11, 6, 10, 4, 8, 4, 7, 3, 5, 2, 4, 2, 4, 2, 5, 3, 4, 1, 2, 1, 1, 0, 2, 2, 3, 1, 3, 2, 5, 3, 7, 4, 8, 4, 7, 3, 6, 3, 6, 3
Offset: 1

Views

Author

Keywords

Comments

Presumably, the positions n such that a(n)=0 are the terms of A097074. - Ivan Neretin, Jul 06 2015

Crossrefs

Programs

  • Mathematica
    a = {0, 1, 1}; Do[AppendTo[a, a[[n]] + a[[n - 1]]]; AppendTo[a, Abs[a[[-1]] - a[[-2]]]], {n, 2, 51}]; a (* Ivan Neretin, Jul 06 2015 *)

Extensions

More terms from Henry Bottomley, May 16 2001

A020944 a(2n+1) = |a(2n) - a(2n-1)|, a(2n) = a(n) + a(n-1), a(0) = -1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) = abs(t(n+1)) if n>0 where t(n) is the twisted Stern sequence defined by R. Bacher and M. Coons. - Michael Somos, Jan 08 2011
a(A153893(n)) = 0. - Reinhard Zumkeller, Mar 13 2011

Examples

			G.f. = -1 + x + x^3 + x^4 + x^6 + x^7 + 2*x^8 + x^9 + x^10 + x^12 + x^13 + 2*x^14 + ...
		

Crossrefs

Programs

  • Haskell
    a020944 n = a020944_list !! n
    a020944_list = -1 : f [1,0] where f (x:y:xs) = x : f (y:xs ++ [x,x+y])
    -- Same list generator function as for a020951_list, cf. A020951.
    -- Reinhard Zumkeller, Mar 13 2013
  • Mathematica
    a[ n_] := Which[ n < 2, Boole[n == 1] - Boole[n == 0], OddQ[n], Abs[a[n - 1] - a[n - 2]], True, a[n/2] + a[n/2 - 1]]; (* Michael Somos, Jul 25 2018 *)
  • PARI
    {a(n) = if( n<2,(n==1) - (n==0),  n%2, abs( a(n-1) - a(n-2) ), a(n/2) + a(n/2 - 1) )}; /* Michael Somos, Jan 08 2011 */
    
  • PARI
    {a(n) = my(A, m); if( n<0, 0, m = 1; A = -1 + O(x); while( m <= n, m*=2; A = 2*x + (1 + x + x^2) * subst( A, x, x^2 ) ); polcoeff( A, n ) )}; /* Michael Somos, Jan 08 2011 */
    

Formula

G.f. A(x) satisfies: A(x) = 2*x + (1 + x + x^2) * A(x^2). - Michael Somos, Jan 08 2011

Extensions

More terms from Henry Bottomley, May 16 2001
Added a(0) from Michael Somos, Jan 08 2011

A020946 a(n) is the smallest number k such that A002487(k) = n.

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 33, 19, 21, 35, 39, 37, 45, 43, 69, 73, 93, 77, 75, 83, 189, 85, 141, 139, 153, 151, 147, 155, 267, 149, 165, 173, 279, 275, 171, 283, 315, 277, 537, 325, 297, 293, 579, 301, 309, 365, 333, 299, 567, 331, 339, 553, 549, 563, 1275, 341, 585, 565, 615, 629
Offset: 0

Views

Author

N. J. A. Sloane and David W. Wilson, Jun 27 2002

Keywords

Examples

			A002487(33) = 6 and this is the first time 6 appears, so a(6) = 33.
		

Crossrefs

Programs

  • Mathematica
    aa = {}; a[0] = 0; a[1] = 1; a[n_] := a[n] = If[EvenQ[n], a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Do[k = 0; While[a[k] != p, k++]; AppendTo[aa, k], {p, 0, 100}]; aa (* Artur Jasinski, Dec 06 2010 *)
  • PARI
    fusc(n)={my(a=1, b=0);while(n,if(bitand(n, 1), b+=a, a+=b);n>>=1); b};
    list(N)={
        my(v=vector(N),k);
        forstep(n=1,9e99,2,
            k=fusc(n);
            if(k<=N && !v[k],
                v[k]=n;
                if(vecmin(v),return(v))
            )
        )
    }; \\ Charles R Greathouse IV, Dec 20 2011
    
  • Python
    from itertools import count
    from functools import reduce
    def A020946(n): return next(filter(lambda k:sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(k)[-1:2:-1],(1,0)))==n,count(1))) if n else 0 # Chai Wah Wu, May 05 2023

A020945 a(2n+1) = |a(2n) - a(2n-1)|, a(2n) = a(n) + a(n-1).

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

A020948 Least k such that b(k) = n, where b( ) is sequence A020944.

Original entry on oeis.org

1, 8, 16, 32, 34, 128, 66, 68, 130, 134, 132, 140, 138, 260, 264, 284, 268, 266, 274, 572, 276, 524, 522, 536, 534, 530, 538, 1034, 532, 548, 556, 1046, 1042, 554, 1050, 1082, 1044, 2072, 1092, 1064, 1060, 2114, 1068, 1076, 1132, 1100, 1066, 2102, 1098, 1106, 2088, 2084, 2098, 4346, 1108
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Which[n < 2, Boole[n == 1] - Boole[n == 0], OddQ[n], Abs[a[n - 1] - a[n - 2]], True, a[n/2] + a[n/2 - 1]]; s = Array[a[#] &, 4200]; Array[FirstPosition[s, #][[1]] &, LengthWhile[Differences@ Union@ s, # == 1 &]] (* Michael De Vlieger, Feb 18 2022, after Michael Somos at A020944 *)

Extensions

More terms from Seiichi Manyama, Feb 18 2022

A020949 Least k such that A(k) = n, where A( ) is sequence A020945.

Original entry on oeis.org

1, 4, 11, 10, 20, 24, 22, 42, 89, 44, 46, 84, 100, 88, 96, 90, 92, 204, 170, 202, 192, 190, 178, 184, 180, 188, 186, 338, 382, 340, 366, 354, 358, 390, 360, 356, 376, 364, 674, 362, 378, 680, 372, 676, 684, 710, 812, 682, 752, 708, 810, 1346, 732
Offset: 1

Views

Author

Keywords

Crossrefs

Showing 1-7 of 7 results.