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

A284019 The "Hofstadter chaotic heart" sequence: a(n) = A004001(n) - A005185(n).

Original entry on oeis.org

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

Views

Author

Altug Alkan, Mar 18 2017

Keywords

Comments

See also scatterplot in Links section.
From Nathan Fox, Mar 30 2017: (Start)
The pattern in the graph presumably comes from the known pattern in the Conway sequence minus n/2 (A004001) combined with the "sausage" pattern of the Q-sequence (A005185). Since the Q-sequence seems to remain close to n/2, the patterns combine in this way.
This means that the bottoms of the hearts should be roughly at powers of 2 and the joins between them should be where the sausages thin out. (End) [Corrected by Altug Alkan, Apr 01 2017]
Note that this comment says that the indices where the bottoms of the hearts occur (the local minima) are roughly powers of 2. For example, a(8056) = -317 is a local minimum close to 2^13. - N. J. A. Sloane, Apr 01 2017

Examples

			a(4) = -1 since a(4) = A004001(4) - A005185(4) = 2 - 3 = -1.
		

Crossrefs

Programs

  • Maple
    A005185:= proc(n) option remember; procname(n-procname(n-1)) +procname(n-procname(n-2)) end proc:
    A005185(1):= 1: A005185(2):= 1:
    A004001:= proc(n) option remember; procname(procname(n-1)) +procname(n-procname(n-1)) end proc:
    A004001(1):= 1: A004001(2):= 1:
    A284019:= map(A004001 - A005185, [$1..1000]):
    seq(A284019[i], i=1..1000); # Altug Alkan, Mar 31 2017
  • Mathematica
    a[n_] := a[n] = If[n <= 2, 1, a[a[n - 1]] + a[n - a[n - 1]]]; b[1] = b[2] = 1; b[n_] := b[n] = b[n - b[n - 1]] + b[n - b[n - 2]]; Table[a@ n - b@ n, {n, 87}] (* Michael De Vlieger, Mar 18 2017, after Robert G. Wilson v at A004001 *)
  • PARI
    q=vector(1000); h=vector(1000); q[1]=q[2]=1; for(n=3, #q, q[n]=q[n-q[n-1]]+q[n-q[n-2]]); h[1]=h[2]=1; for(n=3, #h, h[n]=h[h[n-1]]+h[n-h[n-1]]); vector(1000, n, h[n]-q[n])
    
  • Scheme
    (define (A284019 n) (- (A004001 n) (A005185 n))) ;; Needs also Scheme-code included in those two entries. - Antti Karttunen, Mar 22 2017

Extensions

Graphically descriptive name added by Antti Karttunen with permission from D. R. Hofstadter, Mar 29 2017

A286560 Compound filter (summands of A004001 & summands of A005185): a(n) = P(A286541(n), A286559(n)), where P(n,k) is sequence A000027 used as a pairing function, with a(1) = a(2) = 0.

Original entry on oeis.org

0, 0, 1, 2, 5, 41, 71, 71, 198, 313, 484, 922, 1153, 1201, 2105, 1565, 2588, 4046, 5001, 7443, 7443, 8851, 10671, 19589, 16570, 16935, 22254, 25313, 25313, 25313, 42891, 28793, 32768, 52795, 65504, 59178, 73355, 89033, 88632, 107660, 129045, 129045, 153471, 167646, 167646, 182446, 182446, 336130, 197244, 233297, 330472, 307358, 270167, 355325, 378466, 332156
Offset: 1

Views

Author

Antti Karttunen, May 18 2017

Keywords

Crossrefs

Programs

Formula

a(1) = a(2) = 0, for n > 2, a(n) = (1/2)*(2 + ((A286541(n)+A286559(n))^2) - A286541(n) - 3*A286559(n)).

A283025 Remainder when sum of first n terms of A005185 is divided by n.

Original entry on oeis.org

0, 0, 1, 3, 0, 2, 5, 0, 3, 6, 9, 2, 6, 10, 1, 5, 10, 16, 3, 9, 15, 21, 4, 13, 20, 1, 9, 17, 25, 3, 14, 22, 30, 7, 18, 27, 0, 11, 21, 32, 3, 14, 26, 38, 5, 16, 27, 46, 8, 19, 35, 49, 8, 23, 38, 51, 11, 25, 41, 57, 12, 27, 50, 2, 15, 35, 52, 67, 19, 40, 58, 5, 25, 44, 64, 7, 28, 47, 67, 9, 31, 52, 73, 13, 34, 56, 80, 16, 38, 62, 86, 18
Offset: 1

Views

Author

Altug Alkan, Feb 27 2017

Keywords

Comments

Numbers n such that a(n) = 0 are 1, 2, 5, 8, 37, 99, 1580, 42029, ...
Sequence is a mixture of regularity and irregularity. - Douglas Hofstadter, Mar 03 2017

Examples

			a(4) = 3 since Sum_{k=1..4} A005185(k) = 1 + 1 + 2 + 3 = 7 and remainder when 7 is divided by 4 is 3.
		

Crossrefs

Programs

  • Maple
    A005185:= proc(n) option remember; procname(n-procname(n-1)) +procname(n-procname(n-2)) end proc:
    A005185(1):= 1: A005185(2):= 1:
    L:= ListTools[PartialSums](map(A005185, [$1..1000])):
    seq(L[i] mod i, i=1..1000); # Robert Israel, Feb 28 2017
  • Mathematica
    h[1]=h[2]=1; h[n_]:=h[n]= h[n-h[n-1]] + h[n-h[n-2]]; Mod[ Accumulate[h /@ Range[100]], Range[100]] (* Giovanni Resta, Feb 27 2017 *)
  • PARI
    a=vector(1000); a[1]=a[2]=1; for(n=3, #a, a[n]=a[n-a[n-1]]+a[n-a[n-2]]); vector(#a, n, sum(k=1, n, a[k]) % n)
    
  • PARI
    first(n)=my(v=vector(n), s); v[1]=v[2]=1; for(k=3, n, v[k]=v[k-v[k-1]]+v[k-v[k-2]]); for(k=1, n, s+=v[k]; v[k]=s%k); v \\ after Charles R Greathouse IV at A282891

Formula

a(n) = (Sum_{k=1..n} A005185(k)) mod n.
a(n) = A076268(n) mod n.

A283467 a(n) = A005185(n+1-A005185(n)).

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 3, 4, 5, 4, 5, 5, 5, 6, 6, 6, 6, 8, 6, 8, 8, 8, 8, 8, 10, 8, 9, 10, 10, 10, 11, 11, 10, 11, 11, 11, 12, 12, 12, 12, 12, 16, 10, 14, 14, 12, 14, 16, 14, 14, 16, 14, 16, 16, 16, 16, 20, 16, 17, 21, 16, 17, 19, 20, 20, 21, 21, 20, 19, 19, 22, 19, 21, 21, 22, 22, 22, 23, 21, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 32, 17, 32
Offset: 1

Views

Author

Antti Karttunen, Mar 22 2017

Keywords

Comments

For n >= 2, a(n) gives the left hand summand for the term q(n+1) of Hofstadter Q-sequence (A005185): q(1) = q(2) = 1; q(n) = q(n-q(n-1)) + q(n-q(n-2)) for n > 2.

Crossrefs

Cf. A005185, A280706 (partial sums), A284173.

Programs

  • Mathematica
    a[1] = a[2] = 1; a[n_] := a[n] = a[n - a[n - 1]] + a[n - a[n - 2]]; Table[a[n + 1 - a[n]], {n, 97}] (* Michael De Vlieger, Mar 22 2017 *)
  • PARI
    q(n) = if(n<3, 1, q(n - q(n - 1)) + q(n - q(n - 2)));
    a(n) = q(n + 1 - q(n)); \\ Indranil Ghosh, Mar 22 2017
  • Scheme
    (define (A283467 n) (A005185 (- (+ n 1) (A005185 n)))) ;; Code for A005185 given under that entry.
    

Formula

a(n) = A005185(n + 1 - A005185(n)).

A286569 Restricted growth sequence transform of "Hofstadter chaotic heart", A284019 (= A004001(n) - A005185(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 18 2017

Keywords

Examples

			We start by setting a(1) = 1 for A284019(1) = 0. Then after, whenever A284019(k) is equal to some A284019(m) with m < k, we set a(k) = a(m). Otherwise (when the value is a new one, not encountered before), we allot for a(k) the least natural number not present among a(1) .. a(k-1).
For n=2, as A284019(2) = 0, which was already present at A284019(1), we set a(2) = a(1) = 1.
For n=3, as A284019(3) = 0, which was already present at n=1, we set a(3) = a(1) = 1.
For n=4, as A284019(4) = -1, which is a new value not encountered before, we set a(4) = 1 + max(a(1),a(2),a(3)) = 2.
For n=5, as A284019(5) = 0, which was already present at n=1, we set a(5) = a(1) = 1.
For n=7, as A284019(7) = -1, which was already present at n=4, we set a(7) = a(4) = 2.
For n=11, as A284019(11) = 1, which is a new value not encountered before (sign matters here), we set a(11) = 1 + max(a(1),..,a(10)) = 3.
		

Crossrefs

A064550 a(1) = 2, a(n)=a(n-1)+2*Q(n)-n, n > 1 where Q = A005185.

Original entry on oeis.org

1, 2, 4, 7, 9, 12, 16, 19, 23, 26, 28, 33, 37, 40, 46, 49, 53, 58, 62, 67, 71, 74, 76, 85, 89, 92, 98, 103, 107, 110, 120, 123, 125, 132, 140, 143, 147, 154, 158, 163, 169, 174, 180, 185, 189, 192, 194, 211, 211, 212, 222, 227, 227, 234, 240, 241
Offset: 0

Views

Author

Roger L. Bagula, Oct 08 2001

Keywords

Crossrefs

Programs

  • ARIBAS
    function a064550(maxarg: integer); var n,r,rm,q: integer; qar: array; begin qar := alloc(array,maxarg + 1); qar[0] := 1; for n := 1 to maxarg do if n < 2 then q := 1; else q := qar[n - qar[n - 1]] + qar[n - qar[n - 2]]; end; qar[n] := q; if n = 1 then r := 2; else r := rm + round(2*(q - n/2)); end; rm := r; write(r," "); end; end; a064550(65);
    
  • Haskell
    a064550 n = a064550_list !! n
    a064550_list = 1 : 2 : zipWith3 (\a q n -> a + 2 * q - n)
        (tail a064550_list) (drop 2 a005185_list) [2..]
    -- Reinhard Zumkeller, May 13 2012
  • Maple
    A064550 := proc(n) option remember; if n=0 then 1 else A064550(n-1)+2*A005185(n-1)(n) - n; fi; end;
  • Mathematica
    q[0] = q[1] = 1;
    q[n_] := q[n - q[n - 1]] + q[n - q[n - 2]];
    a[1] = 2;
    a[n_] := a[n] = a[n - 1] + 2*(q[n] - n/2);
    Table[ a[n], {n, 1, 70} ]

Extensions

More terms from Vladeta Jovovic, Klaus Brockhaus and Matthew Conroy, Oct 09 2001

A076268 Sum(k=1,n, A005185(k)).

Original entry on oeis.org

1, 2, 4, 7, 10, 14, 19, 24, 30, 36, 42, 50, 58, 66, 76, 85, 95, 106, 117, 129, 141, 153, 165, 181, 195, 209, 225, 241, 257, 273, 293, 310, 327, 347, 368, 387, 407, 429, 450, 472, 495, 518, 542, 566, 590, 614, 638, 670, 694, 719, 749, 777, 803, 833, 863, 891
Offset: 1

Views

Author

Benoit Cloitre, Nov 05 2002

Keywords

Comments

Partial sums of Hofstadter Q-sequence. The subsequence of primes in the partial sum begins: 2, 7, 19, 181, 241, 257, 293, 347, 719, 863. The subsequence of square in the partial sum begins: 1, 4, 36, 225. [From Jonathan Vos Post, Apr 09 2010]

Crossrefs

Cf. A005185.

A076701 Values of n not reached in the Hofstadter sequence (A005185).

Original entry on oeis.org

7, 13, 15, 18, 27, 29, 34, 36, 49, 51, 59, 67, 70, 74, 81, 89, 95, 97, 98, 99, 102, 103, 117, 126, 127, 131, 134, 141, 142, 145, 150, 158, 163, 166, 181, 183, 189, 191, 195, 197, 198, 199, 205, 207, 209, 213, 224, 225, 232, 247, 259, 265, 267, 270, 274, 281
Offset: 1

Views

Author

Benoit Cloitre, Oct 26 2002

Keywords

Comments

For any n, there is no solution to a(n) = A005185(x). Does lim_{n -> infinity} a(n)/n exist?
Plotting a(n)/n for the first 6 billion terms, it appears to be converging to ~7.39. - Benjamin Chaffin, Sep 17 2019

Crossrefs

Cf. A005185.

Programs

  • Mathematica
    a[1] = a[2] = 1; a[n_] := a[n] = a[n - a[n - 1]] + a[n - a[n - 2]]; t = Table[a[n], {n, 1000}]; Take[ Complement[ Range@ 502, Union@ t], 56]

A087740 a(n) = 1 + abs(A004001(A005185(n)) - A005185(A004001(n))).

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 2, 2, 2, 4, 1, 2, 2, 2, 2, 1, 2, 1, 2, 3, 3, 1, 1, 1, 3, 3, 1, 3, 2, 1, 1, 2, 1, 5, 5, 5, 5, 2, 2, 2, 2, 7, 1, 2, 2, 3, 3, 3, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 3, 2, 2, 6, 7, 7, 4, 3, 4, 4, 2, 2, 2, 4, 4, 3, 7, 3, 3, 2, 6, 3, 1, 2, 3, 1, 3, 2, 1, 3, 1, 1, 3, 1, 3, 2, 9, 5, 9, 10
Offset: 1

Views

Author

Roger L. Bagula, Oct 01 2003

Keywords

Comments

A "commutator" between the Hofstadter A005185 sequence and the Conway-Hofstadter A004001 sequence.

Crossrefs

Cf. A004001, A005185, A284019 (compare the scatter plots).
Cf. also A286560.

Programs

  • Mathematica
    Conway[n_Integer?Positive] := Conway[n] =Conway[Conway[n-1]] + Conway[n - Conway[n-1]] Conway[1] = Conway[2] = 1 Hofstadter[n_Integer?Positive] := Hofstadter[n] = Hofstadter[n - Hofstadter[n-1]] + Hofstadter[n - Hofstadter[n-2]] Hofstadter[1] = Hofstadter[2] = 1 digits=200 a=Table[1+Abs[Conway[Hofstadter[n]]-Hofstadter[Conway[n]]], {n, 1, digits}]
  • Scheme
    (define (A087740 n) (+ 1 (abs (- (A004001 (A005185 n)) (A005185 (A004001 n)))))) ;; Scheme-code for A004001 and A005185 given under those entries.

Extensions

Data section extended to 120 terms by Antti Karttunen, May 22 2017

A226244 Successive record-setters (maxima) in Hofstadter's Q-sequence (A005185).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 10, 11, 12, 16, 20, 21, 22, 23, 24, 32, 40, 42, 43, 44, 46, 47, 48, 64, 66, 68, 72, 78, 80, 82, 83, 85, 88, 90, 92, 94, 96, 128, 130, 138, 149, 151, 152, 159, 162, 165, 168, 169, 170
Offset: 1

Views

Author

Jeffrey Shallit, Jun 01 2013

Keywords

Comments

a(n) = A005185(A226245(n)).

Examples

			a(8) = 10 because the first few terms of Hofstadter's Q-sequence are 1,1,2,3,3,4,5,5,6,6,6,8,8,8,10,9 and 10 is the 8th record value.
		

Crossrefs

Programs

  • Haskell
    a226244 n = a226244_list !! (n-1)
    (a226244_list, a226245_list) = unzip $ (1,1) : f 1 1 a005185_list where
       f i v (q:qs) | q > v = (q,i) : f (i + 1) q qs
                    | otherwise = f (i + 1) v qs
    -- Reinhard Zumkeller, Jun 02 2013
Showing 1-10 of 246 results. Next