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 384 results. Next

A086893 a(n) is the index of F(n+1) at the unique occurrence of the ordered pair of reversed consecutive terms (F(n+1),F(n)) in Stern's diatomic sequence A002487, where F(k) denotes the k-th term of the Fibonacci sequence A000045.

Original entry on oeis.org

1, 3, 5, 13, 21, 53, 85, 213, 341, 853, 1365, 3413, 5461, 13653, 21845, 54613, 87381, 218453, 349525, 873813, 1398101, 3495253, 5592405, 13981013, 22369621, 55924053, 89478485, 223696213, 357913941, 894784853, 1431655765, 3579139413
Offset: 1

Views

Author

John W. Layman, Sep 18 2003

Keywords

Comments

If the Fibonacci pairs are kept in the natural order (F(n),F(n+1)), it appears that the first term of the pair occurs in A002487 at the index given by A061547(n).
Equals row sums of triangle A177954. - Gary W. Adamson, May 15 2010
Starting at n=3, begin subtracting from (2^(n-1)-1)/2^(n-1): 3/4 - 1/2 = 1/4 with 1+4=5=a(3); 7/8 - 1/4 = 5/8 with 5+8=13=a(4); 15/16 - 5/8 = 5/16 with 5+16=21= a(5); 31/32 - 5/16 = 21/32 with 21+32=53=a(6); 63/64 - 21/32 = 21/64 with 21+64=85=a(7) and so on. For n odd in the first fraction (2^(n-1)-1)/2^(n-1), the result approaches 1/3, and for n even in the first fraction, the result approaches 2/3. - J. M. Bergot, May 08 2015
Also, the decimal representation of the x-axis, from the left edge to the origin, of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 678", based on the 5-celled von Neumann neighborhood, initialized with a single black (ON) cell at stage zero. See A283641. - Robert Price, Mar 12 2017

Examples

			A002487 begins 0,1,1,2,1,3,2,... with offset 0. Thus a(1)=1 since (F(2),F(1)) = (1,1) occurs at term 1 of A002487. Similarly, a(2)=3 and a(3)=5, since (F(3),F(2))=(2,1) occurs at term 3 and (F(4),F(3))=(3,2) at term 5 of A002487.
		

Crossrefs

Interleaving of A002450\{0} and A072197.
Positive terms of A096773 in ascending order.
Partial sums of A158302.

Programs

  • Magma
    [2^(n-1)*(3-(-1)^n/3)-1/3: n in [0..35]]; // Vincenzo Librandi, May 09 2015
    
  • Mathematica
    f[n_] := Module[{a = 1, b = 0, m = n}, While[m > 0, If[OddQ@ m, b = a + b, a = a + b]; m = Floor[m/2]]; b]; a = Table[f[n], {n, 0, 10^6}]; b = Reverse /@ Partition[Map[Fibonacci, Range[Ceiling@ Log[GoldenRatio, Max@ a] + 1]], 2, 1]; Map[If[Length@ # > 0, #[[1, 1]] - 1, 0] &@ SequencePosition[a, #] &, b] (* Michael De Vlieger, Mar 15 2017, Version 10.1, after Jean-François Alcover at A002487 *)
  • PARI
    a(n)=if(n%2,2^(n+1),2^(n+1)+2^(n-1))\3 \\ Charles R Greathouse IV, May 08 2015
    
  • Python
    def A086893(n): return (1<Chai Wah Wu, Apr 29 2024

Formula

It appears that a(n)=(4^((n+1)/2)-1)/3 if n is odd and a(n)=(a(n-1)+a(n+1))/2 if n is even.
G.f.: (1+2*x-2*x^2)/((1-x)*(1-4*x^2)); a(n) = 2^(n-1)(3-(-1)^n/3)-1/3 (offset 0); a(n) = Sum{k=0..n+1, 4^floor(k/2)/2} (offset 0); a(2n) = A002450(n+1) (offset 0); a(2n+1) = A072197(n) (offset 0). - Paul Barry, May 21 2004
a(n+2) = 4*a(n) + 1, a(1) = 1, a(2) = 3, n > 0. - Yosu Yurramendi, Mar 07 2017
a(n+1) = a(n) + A158302(n), a(1) = 1, n > 0. - Yosu Yurramendi, Mar 07 2017

Extensions

More terms from Paul Barry, May 21 2004

A258996 Permutation of the positive integers: this permutation transforms the enumeration system of positive irreducible fractions A002487/A002487' (Calkin-Wilf) into the enumeration system A162911/A162912 (Drib), and vice versa.

Original entry on oeis.org

1, 2, 3, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13, 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53
Offset: 1

Views

Author

Yosu Yurramendi, Jun 16 2015

Keywords

Comments

As A258746 the permutation is self-inverse. Except for fixed points 1, 2, 3 it consists completely of 2-cycles: (4,6), (5,7), (8,10), (9,11), (12,14), (13,15), (16,26), (17,27), ..., (21,31), ..., (32,42), ... . - Yosu Yurramendi, Mar 31 2016
When terms of sequence |n - a(n)|/2 (n > 3) are considered only once, and they are sorted in increasing order, A147992 is obtained. - Yosu Yurramendi, Apr 05 2016

Crossrefs

Cf. A092569, A117120, A258746. Similar R-programs: A332769, A284447.

Programs

  • R
    maxlevel <- 5 # by choice
    a <- 1
    for(m in 0:maxlevel) for(k in 0:(2^m-1)){
      a[2^(m+1) + 2*k    ] = 2*a[2^(m+1) - 1 - k]
      a[2^(m+1) + 2*k + 1] = 2*a[2^(m+1) - 1 - k] + 1}
    a
    
  • R
    # Given n, compute a(n) by taking into account the binary representation of n
    maxblock <- 7 # by choice
    a <- 1:3
    for(n in 4:2^maxblock){
      ones <- which(as.integer(intToBits(n)) == 1)
      nbit <- as.integer(intToBits(n))[1:tail(ones, n = 1)]
      anbit <- nbit
      anbit[seq(2, length(anbit) - 1, 2)] <- 1 - anbit[seq(2, length(anbit) - 1, 2)]
      a <- c(a, sum(anbit*2^(0:(length(anbit) - 1))))
    }
    a
    # Yosu Yurramendi, Mar 30 2021

Formula

a(1) = 1, a(2) = 2, a(3) = 3. For n = 2^m + k, m > 1, 0 <= k < 2^m. If m is even, then a(2^(m+1)+k) = a(2^m + k) + 2^m and a(2^(m+1) + 2^m+k) = a(2^m+k) + 2^(m+1). If m is odd, then a(2^(m+1) + k) = a(2^m+k) + 2^(m+1) and a(2^(m+1) + 2^m+k) = a(2^m+k) + 2^m.
From Yosu Yurramendi, Mar 23 2017: (Start)
A258746(a(n)) = a(A258746(n)), n > 0.
A092569(a(n)) = a(A092569(n)), n > 0.
A117120(a(n)) = a(A117120(n)), n > 0;
A065190(a(n)) = a(A065190(n)), n > 0;
A054429(a(n)) = a(A054429(n)), n > 0;
A063946(a(n)) = a(A063946(n)), n > 0. (End)
a(1) = 1, for m >= 0 and 0 <= k < 2^m, a(2^(m+1) + 2*k) = 2*a(2^(m+1) - 1 - k), a(2^(m+1) + 2*k + 1) = 2*a(2^(m+1) - 1 - k) + 1. - Yosu Yurramendi, May 23 2020
a(n) = A020988(A102572(n)) XOR n. - Alan Michael Gómez Calderón, Mar 11 2025

A323901 a(n) = A002487(A163511(n)).

Original entry on oeis.org

1, 1, 1, 2, 1, 4, 2, 3, 1, 8, 4, 7, 2, 4, 3, 3, 1, 14, 8, 11, 4, 18, 7, 9, 2, 12, 4, 9, 3, 8, 3, 5, 1, 22, 14, 43, 8, 34, 11, 47, 4, 16, 18, 23, 7, 26, 9, 13, 2, 16, 12, 23, 4, 18, 9, 17, 3, 6, 8, 11, 3, 6, 5, 5, 1, 64, 22, 127, 14, 112, 43, 97, 8, 84, 34, 121, 11, 26, 47, 111, 4, 66, 16, 89, 18, 40, 23, 57, 7, 36, 26, 57, 9, 50, 13, 29, 2, 50
Offset: 0

Views

Author

Antti Karttunen, Feb 09 2019

Keywords

Crossrefs

Cf. also A323902, A323903.

Programs

Formula

a(n) = A002487(A163511(n)).
a(2^n) = 1 for all n >= 0.

A323902 a(n) = A002487(A156552(n)).

Original entry on oeis.org

0, 1, 1, 2, 1, 3, 1, 3, 2, 4, 1, 5, 1, 5, 3, 4, 1, 5, 1, 7, 4, 6, 1, 7, 2, 7, 3, 9, 1, 8, 1, 5, 5, 8, 3, 8, 1, 9, 6, 10, 1, 11, 1, 11, 5, 10, 1, 9, 2, 7, 7, 13, 1, 7, 4, 13, 8, 11, 1, 13, 1, 12, 7, 6, 5, 14, 1, 15, 9, 11, 1, 11, 1, 13, 5, 17, 3, 17, 1, 13, 4, 14, 1, 18, 6, 15, 10, 16, 1, 12, 4, 19, 11, 16, 7, 11, 1, 9, 9, 12, 1, 20, 1, 19, 8
Offset: 1

Views

Author

Antti Karttunen, Feb 09 2019

Keywords

Comments

Even though certain subset of terms of A156552 soon grow quite big, this sequence still has a quite moderate growth rate, thanks to the compensating effect of A002487.

Crossrefs

Programs

  • PARI
    A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n))));
    A323902(n) = A002487(A156552(n));

Formula

a(n) = A002487(A156552(n)) = A002487(A322993(n)).
a(p) = 1 for all primes p.

A324294 a(n) = A002487(1+sigma(n)).

Original entry on oeis.org

1, 1, 3, 1, 3, 5, 4, 1, 3, 7, 5, 7, 4, 7, 7, 1, 7, 3, 8, 13, 6, 11, 7, 9, 1, 13, 11, 10, 5, 15, 6, 1, 9, 11, 9, 7, 10, 9, 10, 19, 13, 11, 12, 21, 13, 15, 9, 11, 7, 9, 15, 16, 11, 13, 15, 13, 14, 19, 9, 29, 6, 11, 18, 1, 21, 19, 14, 7, 11, 19, 15, 9, 18, 17, 11, 22, 11, 29, 14, 25, 9, 7, 21, 16, 19, 17, 13, 31, 19, 29, 13, 29, 8, 19, 13, 13, 16
Offset: 1

Views

Author

Antti Karttunen, Feb 22 2019

Keywords

Crossrefs

Programs

  • Mathematica
    A002487[m_] := Module[{a = 1, b = 0, n = m}, While[n > 0, If[OddQ[n], b = a + b, a = a + b]; n = Floor[n/2]]; b];
    a[n_] := A002487[1 + DivisorSigma[1, n]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 11 2023 *)
  • PARI
    A002487(n) = { my(s=sign(n), a=1, b=0); n = abs(n); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (s*b); };
    A324294(n) = A002487(1+sigma(n));
    
  • Python
    from functools import reduce
    from sympy import divisor_sigma
    def A324294(n): return reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(divisor_sigma(n)+1)[-1:1:-1],(1,0))[1] # Chai Wah Wu, Jun 19 2022

Formula

a(n) = A002487(1+sigma(n)).
a(2^n) = 1 for all n >= 0, but also for some other numbers, e.g., a(25) = 1.

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

A070871 a(n) = A002487(n) * A002487(n+1) (Conway's alimentary function).

Original entry on oeis.org

1, 2, 2, 3, 6, 6, 3, 4, 12, 15, 10, 10, 15, 12, 4, 5, 20, 28, 21, 24, 40, 35, 14, 14, 35, 40, 24, 21, 28, 20, 5, 6, 30, 45, 36, 44, 77, 70, 30, 33, 88, 104, 65, 60, 84, 63, 18, 18, 63, 84, 60, 65, 104, 88, 33, 30, 70, 77, 44, 36, 45, 30, 6, 7, 42, 66
Offset: 1

Views

Author

N. J. A. Sloane, May 19 2002

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<2, n,
         (q-> b(q)+(n-2*q)*b(n-q))(iquo(n, 2)))
        end:
    a:= n-> b(n)*b(n+1):
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 11 2021
  • Mathematica
    a[0] = 1; a[n_] := If[ OddQ[n], a[n/2 - 1/2], a[n/2] + a[n/2 - 1]]; Table[ a[n - 1]*a[n], {n, 1, 70}]
  • Python
    def a002487(n): return n if n<2 else a002487(n/2) if n%2==0 else a002487((n - 1)/2) + a002487((n + 1)/2)
    def a(n): return a002487(n)*a002487(n + 1) # Indranil Ghosh, Jun 08 2017
    
  • Python
    from functools import reduce
    def A070871(n): return sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0)))*sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n+1)[-1:2:-1],(1,0))) # Chai Wah Wu, May 05 2023

Formula

Sum of reciprocals of k-th "chunk" (between two entries k) = 1 (for example for the third chunk, 1/3 + 1/6 + 1/6 + 1/3 = 1).

A287896 a(n) = A002487(n)*A001511(n).

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 3, 4, 4, 6, 5, 6, 5, 6, 4, 5, 5, 8, 7, 9, 8, 10, 7, 8, 7, 10, 8, 9, 7, 8, 5, 6, 6, 10, 9, 12, 11, 14, 10, 12, 11, 16, 13, 15, 12, 14, 9, 10, 9, 14, 12, 15, 13, 16, 11, 12, 10, 14, 11, 12, 9, 10, 6, 7, 7, 12, 11, 15, 14, 18, 13, 16, 15, 22, 18, 21, 17, 20, 13, 15, 14, 22, 19, 24, 21, 26, 18, 20, 17
Offset: 1

Views

Author

I. V. Serov, Jun 02 2017

Keywords

Comments

Proposed name: N-fusc.
Each number n>0 appears in this sequence exactly n times.
From Yosu Yurramendi, Apr 08 2019: (Start)
The terms (n>0) may be written as a left-justified array with rows of length 2^m:
1,
2, 2,
3, 3, 4, 3,
4, 4, 6, 5, 6, 5, 6, 4,
5, 5, 8, 7, 9, 8, 10, 7, 8, 7, 10, 8, 9, 7, 8, 5,
6, 6, 10, 9, 12, 11, 14, 10, 12, 11, 16, 13, 15, 12, 14, 9, 10, 9, ...
...
as well as right-justified fashion:
1,
2, 2,
3, 3, 4, 3,
4, 4, 6, 5, 6, 5, 6, 4,
5, 5, 8, 7, 9, 8, 10, 7, 8, 7, 10, 8, 9, 7, 8, 5,
... 14, 9, 10, 9, 14, 12, 15, 13, 16, 11, 12, 10, 14, 11, 12, 9, 10, 6,
From these two dispositions interesting properties can be induced (see FORMULA section)
(End)

Crossrefs

Programs

  • Mathematica
    Table[Block[{a = 1, b = 0, m = n}, While[m > 0, If[OddQ@ m, b = a + b, a = a + b]; m = Floor[m/2]]; b] IntegerExponent[2 n, 2], {n, 89}] (* Michael De Vlieger, Jun 14 2017, after Jean-François Alcover at A002487 *)
  • Python
    from functools import reduce
    def A287896(n): return (n&-n).bit_length()*sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0))) # Chai Wah Wu, Jul 14 2022

Formula

a(1) = 1; for n>1: a(n) = (A002487(n-1) + A002487(n) + A002487(n+1))/2.
a(n) = A007306(n) - A288002(n).
From Yosu Yurramendi, Apr 08 2019: (Start)
For m >= 0, 0 <= k < 2^m, a(2^(m+1)+k) - a(2^m+k) = a(k). a(0) = 1 is needed.
For m >= 0, 0 <= k < 2^m, a(2^(m+1)-1-k) - a(2^(m)-1-k) = a(k).
(End)

A317843 Dirichlet inverse of Stern's diatomic sequence (A002487).

Original entry on oeis.org

1, -1, -2, 0, -3, 2, -3, 0, 0, 3, -5, 0, -5, 3, 8, 0, -5, 0, -7, 0, 4, 5, -7, 0, 2, 5, 0, 0, -7, -8, -5, 0, 14, 5, 9, 0, -11, 7, 10, 0, -11, -4, -13, 0, -8, 7, -9, 0, 0, -2, 8, 0, -13, 0, 19, 0, 18, 7, -11, 0, -9, 5, 14, 0, 23, -14, -11, 0, 14, -9, -13, 0, -15, 11, -20, 0, 13, -10, -13, 0, 2, 11, -19, 0, 9, 13, 10, 0, -17, 8, 11, 0
Offset: 1

Views

Author

Antti Karttunen, Aug 09 2018

Keywords

Crossrefs

Programs

  • Mathematica
    s[0] = 0; s[1] = 1;
    s[n_] := s[n] = If[EvenQ[n], s[n/2], s[(n-1)/2] + s[(n+1)/2]];
    a[n_] := a[n] = If[n == 1, 1, -Sum[s[n/d] a[d], {d, Most@ Divisors[n]}]];
    Array[a, 100] (* Jean-François Alcover, Feb 16 2020 *)
  • PARI
    A002487(n) = { my(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); (b); }; \\ From A002487
    A317843(n) = if(1==n,1,-sumdiv(n,d,if(dA002487(n/d)*A317843(d),0)));

Formula

a(1) = 1; for n > 1, a(n) = -Sum_{d|n, dA002487(n/d)*a(d).

A323365 Sum of Stern's Diatomic sequence, A002487 and its Dirichlet inverse, A317843.

Original entry on oeis.org

2, 0, 0, 1, 0, 4, 0, 1, 4, 6, 0, 2, 0, 6, 12, 1, 0, 4, 0, 3, 12, 10, 0, 2, 9, 10, 8, 3, 0, -4, 0, 1, 20, 10, 18, 4, 0, 14, 20, 3, 0, 4, 0, 5, 4, 14, 0, 2, 9, 5, 20, 5, 0, 8, 30, 3, 28, 14, 0, 4, 0, 10, 20, 1, 30, -8, 0, 5, 28, 0, 0, 4, 0, 22, -2, 7, 30, 0, 0, 3, 16, 22, 0, 8, 30, 26, 28, 5, 0, 20, 30, 7, 20, 18, 42, 2, 0, 9, 4, 7, 0, 4, 0, 5, 0
Offset: 1

Views

Author

Antti Karttunen, Jan 13 2019

Keywords

Crossrefs

Cf. A002487 (also a quadrisection of this sequence), A317843.

Programs

Formula

a(n) = A002487(n) + A317843(n).
From Antti Karttunen, Dec 08 2021: (Start)
a(1) = 2, and for n > 1, a(n) = -Sum_{d|n, 1A002487(d) * A317843(n/d).
a(4*n) = A002487(n).
(End)
Showing 1-10 of 384 results. Next