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

A265903 Square array read by descending antidiagonals: A(1,k) = A188163(k), and for n > 1, A(n,k) = A087686(1+A(n-1,k)).

Original entry on oeis.org

1, 3, 2, 5, 7, 4, 6, 12, 15, 8, 9, 14, 27, 31, 16, 10, 21, 30, 58, 63, 32, 11, 24, 48, 62, 121, 127, 64, 13, 26, 54, 106, 126, 248, 255, 128, 17, 29, 57, 116, 227, 254, 503, 511, 256, 18, 38, 61, 120, 242, 475, 510, 1014, 1023, 512, 19, 42, 86, 125, 247, 496, 978, 1022, 2037, 2047, 1024, 20, 45, 96, 192, 253, 502, 1006, 1992, 2046, 4084, 4095, 2048
Offset: 1

Views

Author

Antti Karttunen, Dec 18 2015

Keywords

Comments

Square array A(n,k) [where n is row and k is column] is read by descending antidiagonals: A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.
For n >= 3, each row n lists the numbers that appear n times in A004001. See also A051135.

Examples

			The top left corner of the array:
     1,    3,    5,    6,     9,    10,    11,    13,    17,    18,    19
     2,    7,   12,   14,    21,    24,    26,    29,    38,    42,    45
     4,   15,   27,   30,    48,    54,    57,    61,    86,    96,   102
     8,   31,   58,   62,   106,   116,   120,   125,   192,   212,   222
    16,   63,  121,  126,   227,   242,   247,   253,   419,   454,   469
    32,  127,  248,  254,   475,   496,   502,   509,   894,   950,   971
    64,  255,  503,  510,   978,  1006,  1013,  1021,  1872,  1956,  1984
   128,  511, 1014, 1022,  1992,  2028,  2036,  2045,  3864,  3984,  4020
   256, 1023, 2037, 2046,  4029,  4074,  4083,  4093,  7893,  8058,  8103
   512, 2047, 4084, 4094,  8113,  8168,  8178,  8189, 16006, 16226, 16281
  1024, 4095, 8179, 8190, 16292, 16358, 16369, 16381, 32298, 32584, 32650
  ...
		

Crossrefs

Inverse permutation: A267104.
Transpose: A265901.
Row 1: A188163.
Row 2: A266109.
Row 3: A267103.
For the known and suspected columns, see the rows listed for transposed array A265901.
Cf. A265900 (main diagonal), A265909 (submain diagonal).
Cf. A162598 (column index of n in array), A265332 (row index of n in array).
Cf. also permutations A267111, A267112.

Programs

Formula

For the first row n=1, A(1,k) = A188163(k), for rows n > 1, A(n,k) = A087686(1+A(n-1,k)).

A265901 Square array read by descending antidiagonals: A(n,1) = A188163(n), and for k > 1, A(n,k) = A087686(1+A(n,k-1)).

Original entry on oeis.org

1, 2, 3, 4, 7, 5, 8, 15, 12, 6, 16, 31, 27, 14, 9, 32, 63, 58, 30, 21, 10, 64, 127, 121, 62, 48, 24, 11, 128, 255, 248, 126, 106, 54, 26, 13, 256, 511, 503, 254, 227, 116, 57, 29, 17, 512, 1023, 1014, 510, 475, 242, 120, 61, 38, 18, 1024, 2047, 2037, 1022, 978, 496, 247, 125, 86, 42, 19, 2048, 4095, 4084, 2046, 1992, 1006, 502, 253, 192, 96, 45, 20
Offset: 1

Views

Author

Antti Karttunen, Dec 18 2015

Keywords

Comments

Square array read by descending antidiagonals: A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), etc.
The topmost row (row 1) of the array is A000079 (powers of 2), and in general each row 2^k contains the sequence (2^n - k), starting from the term (2^(k+1) - k). This follows from the properties (3) and (4) of A004001 given on page 227 of Kubo & Vakil paper (page 3 in PDF).
Moreover, each row 2^k - 1 (for k >= 2) contains the sequence 2^n - n - (k-2), starting from the term (2^(k+1) - (2k-1)). To see why this holds, consider the definitions of sequences A162598 and A265332, the latter which also illustrates how the frequency counts Q_n for A004001 are recursively constructed (in the Kubo & Vakil paper).

Examples

			The top left corner of the array:
   1,  2,   4,   8,  16,   32,   64,  128,  256,   512,  1024, ...
   3,  7,  15,  31,  63,  127,  255,  511, 1023,  2047,  4095, ...
   5, 12,  27,  58, 121,  248,  503, 1014, 2037,  4084,  8179, ...
   6, 14,  30,  62, 126,  254,  510, 1022, 2046,  4094,  8190, ...
   9, 21,  48, 106, 227,  475,  978, 1992, 4029,  8113, 16292, ...
  10, 24,  54, 116, 242,  496, 1006, 2028, 4074,  8168, 16358, ...
  11, 26,  57, 120, 247,  502, 1013, 2036, 4083,  8178, 16369, ...
  13, 29,  61, 125, 253,  509, 1021, 2045, 4093,  8189, 16381, ...
  17, 38,  86, 192, 419,  894, 1872, 3864, 7893, 16006, 32298, ...
  18, 42,  96, 212, 454,  950, 1956, 3984, 8058, 16226, 32584, ...
  19, 45, 102, 222, 469,  971, 1984, 4020, 8103, 16281, 32650, ...
  20, 47, 105, 226, 474,  977, 1991, 4028, 8112, 16291, 32661, ...
  22, 51, 112, 237, 490,  999, 2020, 4065, 8158, 16347, 32728, ...
  23, 53, 115, 241, 495, 1005, 2027, 4073, 8167, 16357, 32739, ...
  25, 56, 119, 246, 501, 1012, 2035, 4082, 8177, 16368, 32751, ...
  28, 60, 124, 252, 508, 1020, 2044, 4092, 8188, 16380, 32764, ...
  ...
		

Crossrefs

Inverse permutation: A267102.
Transpose: A265903.
Cf. A265900 (main diagonal).
Cf. A162598 (row index of n in array), A265332 (column index of n in array).
Column 1: A188163.
Column 2: A266109.
Row 1: A000079 (2^n).
Row 2: A000225 (2^n - 1, from 3 onward).
Row 3: A000325 (2^n - n, from 5 onward).
Row 4: A000918 (2^n - 2, from 6 onward).
Row 5: A084634 (?, from 9 onward).
Row 6: A132732 (2^n - 2n + 2, from 10 onward).
Row 7: A000295 (2^n - n - 1, from 11 onward).
Row 8: A036563 (2^n - 3).
Row 9: A084635 (?, from 17 onward).
Row 12: A048492 (?, from 20 onward).
Row 13: A249453 (?, from 22 onward).
Row 14: A183155 (2^n - 2n + 1, from 23 onward. Cf. also A244331).
Row 15: A000247 (2^n - n - 2, from 25 onward).
Row 16: A028399 (2^n - 4).
Cf. also permutations A267111, A267112.

Programs

Formula

For the first column k=1, A(n,1) = A188163(n), for columns k > 1, A(n,k) = A087686(1+A(n,k-1)).

A266109 a(n) = A087686(1+A188163(n)); second column of A265901, second row of A265903.

Original entry on oeis.org

2, 7, 12, 14, 21, 24, 26, 29, 38, 42, 45, 47, 51, 53, 56, 60, 71, 76, 80, 83, 85, 90, 93, 95, 99, 101, 104, 109, 111, 114, 118, 123, 136, 142, 147, 151, 154, 156, 162, 166, 169, 171, 176, 179, 181, 185, 187, 190, 196, 199, 201, 205, 207, 210, 215, 217, 220, 224, 230, 232, 235, 239, 244, 250, 265, 272
Offset: 1

Views

Author

Antti Karttunen, Jan 12 2016

Keywords

Crossrefs

Formula

a(n) = A087686(1+A188163(n)).

A266399 a(n) = A188163(A088359(n)); positions where A004001 obtains unique values.

Original entry on oeis.org

5, 9, 10, 17, 18, 19, 22, 33, 34, 35, 36, 39, 40, 43, 49, 65, 66, 67, 68, 69, 72, 73, 74, 77, 78, 81, 87, 88, 91, 97, 107, 129, 130, 131, 132, 133, 134, 137, 138, 139, 140, 143, 144, 145, 148, 149, 152, 158, 159, 160, 163, 164, 167, 173, 174, 177, 183, 193, 194, 197, 203, 213, 228, 257, 258, 259, 260, 261
Offset: 1

Views

Author

Antti Karttunen, Jan 18 2016

Keywords

Comments

Numbers n for which A004001(n-1) < A004001(n) < A004001(n+1).

Crossrefs

Cf. A004001.
Subsequence of A088359 and A188163.
Cf. also A266188.

Formula

a(n) = A188163(A088359(n)) = A088359(A088359(n)-1) = A188163(A188163(1+n)).
Other identities. For all n >= 1:
A004001(a(n)) = A088359(n).

A209247 a(n) = p(p(n)) + p(p( abs(n - p(p(n-1))) )), where p(n) = A188163(n) + 1 - [n=1].

Original entry on oeis.org

1, 23, 33, 40, 61, 62, 65, 80, 115, 116, 117, 120, 125, 128, 141, 199, 228, 229, 230, 231, 234, 237, 238, 241, 246, 249, 264, 286, 289, 304, 370, 403, 449, 450, 451, 452, 453, 456, 459, 460, 461, 464, 469, 470, 473, 483, 486, 496, 518, 519, 522, 527, 530, 543
Offset: 2

Views

Author

Roger L. Bagula, Jan 13 2013

Keywords

Crossrefs

Programs

  • Magma
    nmax:=200;
    h:=[n le 2 select 1 else Self(Self(n-1)) + Self(n - Self(n-1)): n in [1..10*nmax]]; // h = A004001
    A188163:= function(n)
       for j in [1..8*nmax+1] do
           if h[j] eq n then return j; end if;
       end for;
    end function;
    // define a sequence based on A188163
    p:= func< n | A188163(n) + 1 - 0^(n-1) >;
    A209247:= function(n)
       if n le 2 then return 1;
       else return p(p(n)) + p(p(Abs(n - p(p(n-1)))));
       end if;
    end function;
    [A209247(n): n in [2..nmax]]; // G. C. Greubel, May 20 2024
    
  • Mathematica
    nmax := 200;
    h[n_]:= h[n]= If[n<3, 1, h[h[n-1]] + h[n-h[n-1]]]; (* A004001 *)
    A188163[n_]:= For[m=1, True, m++, If[h[m]==n, Return[m]]];
    (* define a sequence from A188163 *)
    p[n_]:= A188163[n] + 1 - Boole[n==1];
    a[n_]:= a[n]= If[n<3, 1, p[p[n]] + p[p[Abs[n-p[p[n-1]]]]]];
    Table[a[n], {n, 2, nmax}]
  • SageMath
    @CachedFunction
    def h(n): return 1 if (n<3) else h(h(n-1)) + h(n - h(n-1)) # h=A004001
    def A188163(n):
        for j in range(1,2*n+1):
            if h(j)==n: return j
    # define a function based on A188163
    def p(n): return A188163(n) + 1 - int(n==1)
    @CachedFunction
    def A209247(n): return 1 if (n<3) else p(p(n)) + p(p(abs(n - p(p(n-1)))))
    [A209247(n) for n in range(2,201)] # G. C. Greubel, May 20 2024

Extensions

Edited by G. C. Greubel, Apr 23 2024

A004001 Hofstadter-Conway $10000 sequence: a(n) = a(a(n-1)) + a(n-a(n-1)) with a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 26, 26, 27, 27, 27, 28, 29, 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42
Offset: 1

Views

Author

Keywords

Comments

On Jul 15 1988 during a colloquium talk at Bell Labs, John Conway stated that he could prove that a(n)/n -> 1/2 as n approached infinity, but that the proof was extremely difficult. He therefore offered $100 to someone who could find an n_0 such that for all n >= n_0, we have |a(n)/n - 1/2| < 0.05, and he offered $10,000 for the least such n_0. I took notes (a scan of my notebook pages appears below), plus the talk - like all Bell Labs Colloquia at that time - was recorded on video. John said afterwards that he meant to say $1000, but in fact he said $10,000. I was in the front row. The prize was claimed by Colin Mallows, who agreed not to cash the check. - N. J. A. Sloane, Oct 21 2015
a(n) - a(n-1) = 0 or 1 (see the D. Newman reference). - Emeric Deutsch, Jun 06 2005
a(A188163(n)) = n and a(m) < n for m < A188163(n). - Reinhard Zumkeller, Jun 03 2011
From Daniel Forgues, Oct 04 2019: (Start)
Conjectures:
a(n) = n/2 iff n = 2^k, k >= 1.
a(n) = 2^(k-1): k times, for n = 2^k - (k-1) to 2^k, k >= 1. (End)

Examples

			If n=4, 2^4=16, a(16-i) = 2^(4-1) = 8 for 0 <= i <= 4-1 = 3, hence a(16)=a(15)=a(14)=a(13)=8.
		

References

  • J. Arkin, D. C. Arney, L. S. Dewald and W. E. Ebel, Jr., Families of recursive sequences, J. Rec. Math., 22 (No. 22, 1990), 85-94.
  • B. W. Conolly, Meta-Fibonacci sequences, in S. Vajda, editor, "Fibonacci and Lucas Numbers and the Golden Section", Halstead Press, NY, 1989, pp. 127-138.
  • R. K. Guy, Unsolved Problems Number Theory, Sect. E31.
  • D. R. Hofstadter, personal communication.
  • C. A. Pickover, Wonders of Numbers, "Cards, Frogs and Fractal sequences", Chapter 96, pp. 217-221, Oxford Univ. Press, NY, 2000.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Vajda, Fibonacci and Lucas Numbers and the Golden Section, Wiley, 1989, see p. 129.
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.

Crossrefs

Cf. A005229, A005185, A080677, A088359, A087686, A093879 (first differences), A265332, A266341, A055748 (a chaotic cousin), A188163 (greedy inverse).
Cf. A004074 (A249071), A005350, A005707, A093878. Different from A086841. Run lengths give A051135.
Cf. also permutations A267111-A267112 and arrays A265901, A265903.

Programs

  • Haskell
    a004001 n = a004001_list !! (n-1)
    a004001_list = 1 : 1 : h 3 1  {- memoization -}
      where h n x = x' : h (n + 1) x'
              where x' = a004001 x + a004001 (n - x)
    -- Reinhard Zumkeller, Jun 03 2011
    
  • Magma
    [n le 2 select 1 else Self(Self(n-1))+ Self(n-Self(n-1)):n in [1..75]]; // Marius A. Burtea, Aug 16 2019
    
  • Maple
    A004001 := proc(n) option remember; if n<=2 then 1 else procname(procname(n-1)) +procname(n-procname(n-1)); fi; end;
  • Mathematica
    a[1] = 1; a[2] = 1; a[n_] := a[n] = a[a[n - 1]] + a[n - a[n - 1]]; Table[ a[n], {n, 1, 75}] (* Robert G. Wilson v *)
  • PARI
    a=vector(100);a[1]=a[2]=1;for(n=3,#a,a[n]=a[a[n-1]]+a[n-a[n-1]]);a \\ Charles R Greathouse IV, Jun 10 2011
    
  • PARI
    first(n)=my(v=vector(n)); v[1]=v[2]=1; for(k=3, n, v[k]=v[v[k-1]]+v[k-v[k-1]]); v \\ Charles R Greathouse IV, Feb 26 2017
    
  • Python
    def a004001(n):
        A = {1: 1, 2: 1}
        c = 1 #counter
        while n not in A.keys():
            if c not in A.keys():
                A[c] = A[A[c-1]] + A[c-A[c-1]]
            c += 1
        return A[n]
    # Edward Minnix III, Nov 02 2015
    
  • SageMath
    @CachedFunction
    def a(n): # a = A004001
        if n<3: return 1
        else: return a(a(n-1)) + a(n-a(n-1))
    [a(n) for n in range(1,101)] # G. C. Greubel, Apr 25 2024
  • Scheme
    ;; An implementation of memoization-macro definec can be found for example from: http://oeis.org/wiki/Memoization
    (definec (A004001 n) (if (<= n 2) 1 (+ (A004001 (A004001 (- n 1))) (A004001 (- n (A004001 (- n 1)))))))
    ;; Antti Karttunen, Oct 22 2014
    

Formula

Limit_{n->infinity} a(n)/n = 1/2 and as special cases, if n > 0, a(2^n-i) = 2^(n-1) for 0 <= i < = n-1; a(2^n+1) = 2^(n-1) + 1. - Benoit Cloitre, Aug 04 2002 [Corrected by Altug Alkan, Apr 03 2017]

A087686 Elements of A004001 that repeat consecutively.

Original entry on oeis.org

1, 2, 4, 7, 8, 12, 14, 15, 16, 21, 24, 26, 27, 29, 30, 31, 32, 38, 42, 45, 47, 48, 51, 53, 54, 56, 57, 58, 60, 61, 62, 63, 64, 71, 76, 80, 83, 85, 86, 90, 93, 95, 96, 99, 101, 102, 104, 105, 106, 109, 111, 112, 114, 115, 116, 118, 119, 120, 121, 123, 124, 125, 126, 127
Offset: 1

Views

Author

Roger L. Bagula, Sep 27 2003

Keywords

Comments

Complement of A088359; A051135(a(n)) > 1. [Reinhard Zumkeller, Jun 03 2011]
From Antti Karttunen, Jan 18 2016: (Start)
This set of numbers is closed with respect to A004001, see A266188.
After 1, one more than the positions of zeros in A093879.
(End)

Crossrefs

Cf. A088359 (complement), A188163 (almost complement).
Cf. A080677 (the least monotonic left inverse).

Programs

  • Haskell
    import Data.List (findIndices)
    a087686 n = a087686_list !! (n-1)
    a087686_list = map succ $ findIndices (> 1) a051135_list
    -- Reinhard Zumkeller, Jun 03 2011
    (Scheme, with Antti Karttunen's IntSeq-library)
    (define A087686 (MATCHING-POS 1 1 (lambda (n) (> (A051135 n) 1))))
    ;; Antti Karttunen, Jan 18 2016
  • Mathematica
    Conway[n_Integer?Positive] := Conway[n] =Conway[Conway[n-1]] + Conway[n - Conway[n-1]] Conway[1] = Conway[2] = 1 digits=1000 a=Table[Conway[n], {n, 1, digits}]; b=Table[If[a[[n]]-a[[n-1]]==0, a[[n]], 0], {n, 2, digits}]; c=Delete[Union[b], 1]

Formula

Other identities. For all n >= 1:
A080677(a(n)) = n. [See comments in A080677.]

A088359 Numbers which occur only once in A004001.

Original entry on oeis.org

3, 5, 6, 9, 10, 11, 13, 17, 18, 19, 20, 22, 23, 25, 28, 33, 34, 35, 36, 37, 39, 40, 41, 43, 44, 46, 49, 50, 52, 55, 59, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 84, 87, 88, 89, 91, 92, 94, 97, 98, 100, 103, 107, 108, 110, 113, 117, 122, 129, 130, 131, 132
Offset: 1

Views

Author

Robert G. Wilson v, Sep 26 2003

Keywords

Comments

Out of the first one million terms (a(10^6) = 510403), 258661 occur only once.
Complement of A087686; A051135(a(n)) = 1. - Reinhard Zumkeller, Jun 03 2011
From Antti Karttunen, Jan 18 2016: (Start)
In general, out of the first 2^(n+1) terms of A004001, 2^(n-1) - 1 terms (a quarter) occur only once. See also illustration in A265332.
One more than the positions of ones in A093879.
(End)

Crossrefs

Positions of ones in A051135.
Cf. A188163 (same sequence with prepended 1).
Cf. A087686 (complement).
Cf. also A267110, A267111, A267112.

Programs

  • Haskell
    import Data.List (elemIndices)
    a088359 n = a088359_list !! (n-1)
    a088359_list = map succ $ elemIndices 1 a051135_list
    -- Reinhard Zumkeller, Jun 03 2011
    (Scheme, with Antti Karttunen's IntSeq-library)
    (define A088359 (ZERO-POS 1 1 (COMPOSE -1+ A051135)))
    ;; Antti Karttunen, Jan 18 2016
  • Mathematica
    a[1] = 1; a[2] = 1; a[n_] := a[n] = a[ a[n - 1]] + a[n - a[n - 1]]; hc = Table[ a[n], {n, 1, 261}]; RunLengthEncodeOne[x_List] := Length[ # ] == 1 & /@ Split[x]; r = RunLengthEncodeOne[hc]; Select[ Range[ Length[r]], r[[ # ]] == True &]

Formula

From Antti Karttunen, Jan 18 2016: (Start)
Other identities.
For all n >= 0, a(A000079(n)) = A000051(n+1), that is, a(2^n) = 2^(n+1) + 1.
For all n >= 1:
a(n) = A004001(A266399(n)).
(End)

A080677 a(n) = n + 1 - A004001(n).

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 9, 9, 9, 9, 10, 10, 10, 11, 11, 12, 13, 13, 14, 15, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 21, 22, 22, 22, 23, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35
Offset: 1

Views

Author

N. J. A. Sloane, Mar 03 2003

Keywords

Comments

From Antti Karttunen, Jan 10 2016: (Start)
This is the sequence b(n) mentioned on page 229 (page 5 of PDF) in Kubo & Vakil paper, but using starting offset 1 instead of 2.
The recursive sum formula for A004001, a(n) = a(a(n-1)) + a(n-a(n-1)) can be written also as a(n) = a(a(n-1)) + a(A080677(n-1)).
This is the least monotonic left inverse for sequence A087686. Proof: Taking the first differences of this sequence yields the characteristic function for the complement of A188163, because A188163 gives the positions where A004001 increases, and this sequence increases by one whenever A004001 does not increase (and vice versa). Sequence A188163 is also 1 followed by A088359 (see comment in former), whose complement A087686 is, thus A087686 is also the complement of A188163, apart from the initial one. Note also how A087686 is closed with respect to A004001 (see A266188).
(End)

References

  • J. Arkin, D. C. Arney, L. S. Dewald and W. E. Ebel, Jr., Families of recursive sequences, J. Rec. Math., 22 (No. 22, 1990), 85-94.

Crossrefs

Programs

Formula

a(n) = n + 1 - A004001(n).
Other identities. For all n >= 1:
a(A087686(n)) = n. [See comments.] - Antti Karttunen, Jan 10 2016

A093879 First differences of A004001.

Original entry on oeis.org

0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0
Offset: 1

Views

Author

N. J. A. Sloane, May 27 2004

Keywords

Comments

All the terms are 0 or 1: it is easy to show that if {b(n)} = A004001, b(n)>=b(n-1) and b(n)Benoit Cloitre, Jun 05 2004

Crossrefs

Programs

  • Magma
    h:=[n le 2 select 1 else Self(Self(n-1)) + Self(n-Self(n-1)): n in [1..160]];
    A093879:= func< n | h[n+1] - h[n] >;
    [A093879(n): n in [1..120]]; // G. C. Greubel, May 19 2024
    
  • Mathematica
    a[1] = a[2] = 1; a[n_] := a[n] = a[a[n - 1]] + a[n - a[n - 1]]; t = Table[a[n], {n, 110}]; Drop[t, 1] - Drop[t, -1] (* Robert G. Wilson v, May 28 2004 *)
  • PARI
    {m=106;v=vector(m,j,1);for(n=3,m,a=v[v[n-1]]+v[n-v[n-1]];v[n]=a);for(n=2,m,print1(v[n]-v[n-1],","))}
    
  • SageMath
    @CachedFunction
    def h(n): return 1 if (n<3) else h(h(n-1)) + h(n - h(n-1))
    def A093879(n): return h(n+1) - h(n)
    [A093879(n) for n in range(1,101)] # G. C. Greubel, May 19 2024
  • Scheme
    (define (A093879 n) (- (A004001 (+ 1 n)) (A004001 n))) ;; Code for A004001 given in that entry. - Antti Karttunen, Jan 18 2016
    

Formula

From Antti Karttunen, Jan 18 2016: (Start)
a(n) = A004001(n+1) - A004001(n).
Other identities. For all n >= 1:
a(A087686(n+1)-1) = 0.
a(A088359(n)-1) = 1.
a(n) = 1 if and only if A051135(n+1) = 1.
(End)

Extensions

More terms and PARI code from Klaus Brockhaus and Robert G. Wilson v, May 27 2004
Showing 1-10 of 14 results. Next