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

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.]

A267111 Permutation of natural numbers: a(1) = 1, a(A087686(n)) = 2*a(n-1), a(A088359(n)) = 1+2*a(n), where A088359 and A087686 = numbers that occur only once (resp. more than once) in A004001, the Hofstadter-Conway $10000 sequence.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 6, 8, 9, 11, 15, 10, 13, 14, 12, 16, 17, 19, 23, 31, 18, 21, 27, 22, 29, 30, 20, 25, 26, 28, 24, 32, 33, 35, 39, 47, 63, 34, 37, 43, 55, 38, 45, 59, 46, 61, 62, 36, 41, 51, 42, 53, 54, 44, 57, 58, 60, 40, 49, 50, 52, 56, 48, 64, 65, 67, 71, 79, 95, 127, 66, 69, 75, 87, 111, 70, 77, 91, 119, 78, 93, 123
Offset: 1

Views

Author

Antti Karttunen, Jan 10 2016

Keywords

Crossrefs

Inverse: A267112.
Similar or related permutations: A006068, A054429, A276441, A233275, A233277, A276343, A276345, A276445.
Cf. also permutations A266411, A266412 and arrays A265901, A265903.

Formula

a(1) = 1; for n > 1, if A093879(n-1) = 0 [when n is in A087686], a(n) = 2*a(A080677(n)-1), otherwise [when n is in A088359], a(n) = 1 + 2*a(A004001(n)-1).
Equally, for n > 1, if A093879(n-1) = 0, a(n) = 2*a(n - A004001(n)), otherwise a(n) = 1 + 2*a(A004001(n)-1). [Above formula in a more symmetric form.]
As a composition of other permutations:
a(n) = A054429(A276441(n)).
a(n) = A233275(A276343(n)).
a(n) = A233277(A276345(n)).
a(n) = A006068(A276445(n)).
Other identities. For all n >= 0:
a(2^n) = 2^n. [Follows from the properties (3) and (4) of A004001 given on page 227 of Kubo & Vakil paper.]

A283470 a(n) = A004001(A004001(n-1)) XOR A004001(n-A004001(n-1)), a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 0, 0, 3, 0, 0, 0, 1, 0, 7, 7, 0, 0, 0, 0, 1, 0, 3, 2, 2, 1, 14, 14, 15, 15, 15, 0, 0, 0, 0, 0, 1, 0, 3, 2, 5, 5, 6, 7, 4, 4, 5, 4, 4, 3, 3, 3, 2, 29, 29, 30, 30, 30, 31, 31, 31, 31, 0, 0, 0, 0, 0, 0, 1, 0, 3, 2, 5, 4, 4, 7, 4, 5, 10, 10, 11, 10, 9, 9, 14, 15, 15, 14, 14, 14, 13, 10, 11, 11, 10, 9, 9, 6, 6, 6, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3
Offset: 1

Views

Author

Antti Karttunen, Mar 18 2017

Keywords

Crossrefs

Cf. A003987, A080677, A283468, A283469, A283472, A283471 (positions of zeros), A283473 (positions where coincides with A004001).
Cf. also A283677.

Programs

Formula

a(n) = A004001(A004001(n-1)) XOR A004001(A080677(n-1)), where XOR is bitwise-xor (A003987)
Other identities. For all n >= 1:
a(n) = A283469(n) - A283472(n).
A004001(n) = a(n) + 2*A283472(n).

Extensions

Erroneous b-file replaced by a correct one - Antti Karttunen, Feb 24 2018

A162598 Ordinal transform of A265332.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This is a fractal sequence.
It appears that each group of 2^k terms starts with 1 and ends with the remaining powers of two from 2^k down to 2^1.
From Antti Karttunen, Jan 09-12 2016: (Start)
This is ordinal transform of A265332, which is modified A051135 (with a(1) = 1, instead of 2). - after Franklin T. Adams-Watters' original definition for this sequence.
A000079 (powers of 2) indeed gives the positions of ones in this sequence. This follows from the properties (3) and (4) of A004001 given on page 227 of Kubo & Vakil paper (page 3 of PDF), which together also imply the pattern observed above, more clearly represented as:
a(2) = 1.
a(3..4) = 2, 1.
a(6..8) = 4, 2, 1.
a(13..16) = 8, 4, 2, 1.
a(28..31) = 16, 8, 4, 2, 1.
etc.
(End)

Crossrefs

Row index of A265901, column index of A265903.
Cf. A265332 (corresponding other index).
Cf. A000079 (positions of ones).
Cf. A000225 (from the term 3 onward the positions of 2's).
Cf. A000325 (from its third term 5 onward the positions of 3's, which occur always as the last term before the next descending subsequence of powers of two).

Programs

  • Mathematica
    terms = 100;
    h[1] = 1; h[2] = 1;
    h[n_] := h[n] = h[h[n - 1]] + h[n - h[n - 1]];
    t = Array[h, 2*terms];
    A051135 = Take[Transpose[Tally[t]][[2]], terms];
    b[_] = 1;
    a[n_] := a[n] = With[{t = If[n == 1, 1, A051135[[n]]]}, b[t]++];
    Array[a, terms] (* Jean-François Alcover, Dec 19 2021, after Robert G. Wilson v in A051135 *)

Formula

Let b(1) = 1, b(n) = A051135(n) for n > 1. Then a(n) is the number of b(k) that equal b(n) for 1 <= k <= n: sum( 1, 1<=k<=n and a(k)=a(n) ).
If A265332(n) = 1, then a(n) = A004001(n), otherwise a(n) = a(A080677(n)-1) = a(n - A004001(n)). - Antti Karttunen, Jan 09 2016

Extensions

Name amended by Antti Karttunen, Jan 09 2016

A276441 Permutation of natural numbers: a(1) = 1, a(A087686(1+n)) = 1 + 2*a(n), a(A088359(n)) = 2*a(n), where A088359 & A087686 = numbers that occur only once & more than once in A004001.

Original entry on oeis.org

1, 3, 2, 7, 6, 4, 5, 15, 14, 12, 8, 13, 10, 9, 11, 31, 30, 28, 24, 16, 29, 26, 20, 25, 18, 17, 27, 22, 21, 19, 23, 63, 62, 60, 56, 48, 32, 61, 58, 52, 40, 57, 50, 36, 49, 34, 33, 59, 54, 44, 53, 42, 41, 51, 38, 37, 35, 55, 46, 45, 43, 39, 47, 127, 126, 124, 120, 112, 96, 64, 125, 122, 116, 104, 80, 121, 114, 100, 72, 113, 98
Offset: 1

Views

Author

Antti Karttunen, Sep 03 2016

Keywords

Crossrefs

Inverse: A276442.
Related or similar permutations: A006068, A054429, A233275, A233277, A267111, A276343, A276345, A276443.
Cf. also arrays A265901, A265903.

Programs

Formula

a(1) = 1; for n > 1, if A093879(n-1) = 0 [when n is in A087686], a(n) = 1 + 2*a(A080677(n)-1), otherwise [when n is in A088359], a(n) = 2*a(A004001(n)-1).
As a composition of other permutations:
a(n) = A054429(A267111(n)).
a(n) = A233277(A276343(n)).
a(n) = A233275(A276345(n)).
a(n) = A006068(A276443(n)).
Other identities. For all n >= 1:
a(A000079(n-1)) = A000225(n).

A276445 Permutation of natural numbers: a(1) = 1, a(A087686(n)) = A001969(1+a(n-1)), a(A088359(n)) = A000069(1+a(n)), where A088359 & A087686 = numbers that occur only once & more than once in A004001, and A000069 & A001969 are odious & evil numbers.

Original entry on oeis.org

1, 3, 2, 6, 7, 4, 5, 12, 13, 14, 8, 15, 11, 9, 10, 24, 25, 26, 28, 16, 27, 31, 22, 29, 19, 17, 30, 21, 23, 18, 20, 48, 49, 50, 52, 56, 32, 51, 55, 62, 44, 53, 59, 38, 57, 35, 33, 54, 61, 42, 63, 47, 45, 58, 37, 39, 34, 60, 41, 43, 46, 36, 40, 96, 97, 98, 100, 104, 112, 64, 99, 103, 110, 124, 88, 101, 107, 118, 76, 105, 115, 70
Offset: 1

Views

Author

Antti Karttunen, Sep 03 2016

Keywords

Crossrefs

Inverse: A276446.
Similar or related permutations: A003188, A267111, A276443 (compare the scatter plots).

Programs

Formula

a(1) = 1; for n > 1, if A093879(n-1) = 0 [when n is in A087686], a(n) = A001969(1+a(A080677(n)-1)), otherwise [when n is in A088359], a(n) = A000069(1+a(A004001(n)-1)).
As a composition of other permutations:
a(n) = A003188(A267111(n)).

A283469 a(n) = A004001(A004001(n-1)) OR A004001(n-A004001(n-1)), a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 1, 1, 3, 2, 2, 2, 3, 3, 7, 7, 4, 4, 4, 4, 5, 5, 7, 7, 7, 7, 14, 14, 15, 15, 15, 8, 8, 8, 8, 8, 9, 9, 11, 11, 13, 13, 14, 15, 14, 14, 15, 15, 15, 15, 15, 15, 15, 29, 29, 30, 30, 30, 31, 31, 31, 31, 16, 16, 16, 16, 16, 16, 17, 17, 19, 19, 21, 21, 21, 23, 22, 23, 26, 26, 27, 27, 27, 27, 30, 31, 31, 31, 31, 31, 31, 30, 31, 31, 31, 31, 31
Offset: 1

Views

Author

Antti Karttunen, Mar 18 2017

Keywords

Crossrefs

Cf. A003986, A283470, A283472, A283473 (positions where coincides with A004001).

Programs

Formula

a(1) = a(2) = 1; for n > 2, a(n) = A004001(A004001(n-1)) OR A004001(A080677(n-1)), where OR is bitwise-or (A003986)
Other identities. For all n >= 1:
a(n) = A283470(n) + A283472(n).
A004001(n) = a(n) + A283472(n).

A283471 Numbers n > 2 such that A004001(A004001(n-1)) = A004001(n-A004001(n-1)).

Original entry on oeis.org

3, 4, 6, 7, 8, 10, 13, 14, 15, 16, 18, 28, 29, 30, 31, 32, 34, 59, 60, 61, 62, 63, 64, 66, 122, 123, 124, 125, 126, 127, 128, 130, 249, 250, 251, 252, 253, 254, 255, 256, 258, 504, 505, 506, 507, 508, 509, 510, 511, 512, 514, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1026, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045
Offset: 1

Views

Author

Antti Karttunen, Mar 18 2017

Keywords

Comments

Equally, numbers n > 2 for which A004001(A004001(n-1)) = A004001(A080677(n-1)).

Crossrefs

Positions of zeros in A283468 and A283470.
Subsequence of A283482.

Programs

  • Mathematica
    a[n_] := a[n] = If[n <= 2, 1, a[a[n - 1]] + a[n - a[n - 1]]]; Select[Range[3, 2^11], Function[n, a[#] == a[n - #] &@ a[n - 1]]] (* Michael De Vlieger, Mar 18 2017, after Robert G. Wilson v at A004001 *)

A283472 a(n) = A004001(A004001(n-1)) AND A004001(n-A004001(n-1)), a(1) = a(2) = 0.

Original entry on oeis.org

0, 0, 1, 1, 0, 2, 2, 2, 2, 3, 0, 0, 4, 4, 4, 4, 4, 5, 4, 5, 5, 6, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 9, 8, 9, 8, 8, 8, 8, 10, 10, 10, 11, 11, 12, 12, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 17, 16, 17, 16, 17, 17, 16, 18, 18, 16, 16, 16, 17, 18, 18, 16, 16, 16, 17, 17, 17, 18, 20, 20, 20, 21, 22, 22, 24, 24, 24, 24
Offset: 1

Views

Author

Antti Karttunen, Mar 18 2017

Keywords

Crossrefs

Cf. A004001, A004198, A283469, A283470, A283473 (positions of zeros).

Programs

Formula

a(1) = a(2) = 0; for n > 2, a(n) = A004001(A004001(n-1)) AND A004001(A080677(n-1)), where AND is bitwise-and (A004198).
Other identities. For all n >= 1:
a(n) = A283469(n) - A283470(n).
A004001(n) = A283469(n) + a(n) = A283470(n) + 2*a(n).
Showing 1-10 of 17 results. Next