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

A266411 a(1) = 1, after which each a(n) = (A004074(n)+1)-th number selected from those not yet in the sequence.

Original entry on oeis.org

1, 2, 4, 3, 6, 8, 7, 5, 10, 12, 14, 13, 16, 15, 11, 9, 18, 20, 22, 24, 23, 26, 28, 27, 30, 29, 25, 32, 31, 21, 19, 17, 34, 36, 38, 40, 42, 41, 44, 46, 48, 47, 50, 52, 51, 54, 53, 49, 56, 58, 57, 60, 59, 55, 62, 61, 45, 43, 64, 63, 39, 37, 35, 33, 66, 68, 70, 72, 74, 76, 75, 78, 80, 82, 84, 83, 86, 88, 90, 89, 92, 94, 93, 96, 95, 91
Offset: 1

Views

Author

Antti Karttunen, Dec 29 2015

Keywords

Crossrefs

Inverse: A266412.
Cf. A004074.
Similar permutations in Quetian style: A119435, A126917, A246165, A266413.
Cf. also A265901, A265903.

Programs

  • Mathematica
    f[n_] := Block[{a = {1}, g, b = Range[2, n]}, g[1] = g[2] = 1; g[x_] := g[x] = g[g[x - 1]] + g[x - g[x - 1]]; Do[{AppendTo[a, #[[1, 1]]], Set[b, Last@ #]} &@ If[# > Length@ b, Break[], TakeDrop[b, {#}]] &@ (2 g[#] - # + 1) &@ k, {k, 2, n}]; a]; f@ 97 (* Michael De Vlieger, Dec 29 2015, Version 10.2, based on Harvey P. Dale at A004074 *)

A283497 Remainder when n is divided by A004074(n), or -1 if A004074(n) = 0.

Original entry on oeis.org

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

Views

Author

Altug Alkan, Mar 11 2017

Keywords

Examples

			a(11) = 2 because remainder when 11 is divided by A004074(11) = 3 is 2.
		

Crossrefs

Formula

a(2^n) = -1 for n > 0.

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]

A317754 Let b(1) = b(2) = 1; for n >= 3, b(n) = n - b(t(n)) - b(n-t(n)) where t = A004001. a(n) = 2*b(n) - n.

Original entry on oeis.org

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

Views

Author

Altug Alkan, Aug 06 2018

Keywords

Crossrefs

Programs

  • Maple
    t:= proc(n) option remember; `if`(n<3, 1,
          t(t(n-1)) +t(n-t(n-1)))
        end:
    b:= proc(n) option remember; `if`(n<3, 1,
          n -b(t(n)) -b(n-t(n)))
        end:
    seq(2*b(n)-n, n=1..100); # after Alois P. Heinz at A317686
  • Mathematica
    Block[{t = NestWhile[Function[{a, n}, Append[a, a[[a[[-1]] ]] + a[[-a[[-1]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, Last@ # < 60 &], b}, b = NestWhile[Function[{b, n}, Append[b, n - b[[t[[n]] ]] - b[[-t[[n]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, Length@ # < Length@ t &]; Array[2 b[[#]] - # &, Length@ b] ] (* Michael De Vlieger, Aug 07 2018 *)
  • PARI
    t=vector(99); t[1]=t[2]=1; for(n=3, #t, t[n] = t[n-t[n-1]]+t[t[n-1]]); b=vector(99); b[1]=b[2]=1; for(n=3, #b, b[n] = n-b[t[n]]-b[n-t[n]]); vector(99, k, 2*b[k]-k)

A249071 a(n) = A004001(2*n) - n, where A004001 is Hofstadter-Conway $10000 sequence.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 22 2014

Keywords

Comments

Hofstadter shows the plot of function A004001(n)-(n/2) at time 10:52 during the part two of DIMACS lecture. This sequence is obtained as the bisection of that function, thus containing only integers. Cf. also A004074.

Crossrefs

Cf. also A233270 (also has a similar Blancmange curve appearance).

Formula

a(n) = A004001(2*n) - n.
a(n) = A004074(2*n) / 2. [Also the even bisection of A004074 halved.]

A317742 Let b(1) = b(2) = 1; for n >= 3, b(n) = b(t(n)) + b(n-t(n)) where t = A287422. a(n) = 2*b(n) - n.

Original entry on oeis.org

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

Views

Author

Altug Alkan, Aug 05 2018

Keywords

Comments

This sequence has fractal-like structure as A004074, although there are substantial differences of this sequence based on slow A287422 and b(n) sequences. See plots of this sequence and A004074 in Links section.

Crossrefs

Programs

  • Maple
    t:= proc(n) option remember; `if`(n<3, 1,
          n -t(t(n-1)) -t(n-t(n-1)))
        end:
    b:= proc(n) option remember; `if`(n<3, 1,
          b(t(n)) +b(n-t(n)))
        end:
    seq(2*b(n)-n, n=1..100); # after Alois P. Heinz at A317686
  • Mathematica
    Block[{t = NestWhile[Function[{a, n}, Append[a, n - a[[a[[-1]] ]] - a[[-a[[-1]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, Last@ # < 10^2 &], b}, b = NestWhile[Function[{b, n}, Append[b, b[[t[[n]] ]] + b[[-t[[n]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, Last@ # < Max@ t &]; Array[2 b[[#]] - # &, Length@ b] ] (* Michael De Vlieger, Aug 07 2018 *)
    t[n_] := t[n] = If[n<3, 1, n - t[t[n-1]] - t[n - t[n-1]]]; b[n_] := b[n] = If[n<3, 1, b[t[n]] + b[n - t[n]]]; Table[2*b[n] - n, {n, 106}] (* Giovanni Resta, Aug 14 2018 *)
  • PARI
    t=vector(199); t[1]=t[2]=1; for(n=3, #t, t[n] = n-t[n-t[n-1]]-t[t[n-1]]); b=vector(199); b[1]=b[2]=1; for(n=3, #b, b[n] = b[t[n]]+b[n-t[n]]); vector(199, k, 2*b[k]-k)

A283655 a(n) = b(b(n+1)) - b(n-b(n)+1) where b(n) = A004001(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, 7
Offset: 1

Views

Author

Altug Alkan, Mar 13 2017

Keywords

Examples

			a(1) = 0 since a(1) = A004001(A004001(2)) - A004001(1-A004001(1)+1) = 1 - 1 = 0.
		

Crossrefs

Programs

  • Mathematica
    b[1] = 1; b[2] = 1; b[n_] := b[n] = b[b[n - 1]] + b[n - b[n - 1]]; a[n_] := b[b[n + 1]] - b[n - b[n] + 1]; Array[a, 100] (* Robert G. Wilson v, Mar 13 2017 *)
  • PARI
    a=vector(1001); a[1]=a[2]=1; for(n=3, #a, a[n]=a[a[n-1]]+a[n-a[n-1]]); va = vector(1000, n, a[a[n+1]]-a[n+1-a[n]])

A367076 Irregular triangle read by rows: T(n,k) (0 <= n, 0 <= k < 2^n). T(n,k) = -Sum_{i=0..k} A365968(n,i).

Original entry on oeis.org

0, 1, 0, 3, 4, 3, 0, 6, 10, 12, 12, 12, 10, 6, 0, 10, 18, 24, 28, 32, 34, 34, 32, 34, 34, 32, 28, 24, 18, 10, 0, 15, 28, 39, 48, 57, 64, 69, 72, 79, 84, 87, 88, 89, 88, 85, 80, 85, 88, 89, 88, 87, 84, 79, 72, 69, 64, 57, 48, 39, 28, 15, 0, 21, 40, 57, 72, 87
Offset: 0

Views

Author

John Tyler Rascoe, Nov 05 2023

Keywords

Examples

			Triangle begins:
    k=0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
n=0:  0;
n=1:  1,  0;
n=2:  3,  4,  3,  0;
n=3:  6, 10, 12, 12, 12, 10,  6,  0;
n=4; 10, 18, 24, 28, 32, 34, 34, 32, 34, 34, 32, 28, 24, 18, 10,  0;
		

Crossrefs

Cf. A000217 (column k=0), A028552 (column k=1), A192021 (row sums).

Programs

  • Mathematica
    nmax=10; row[n_]:=Join[CoefficientList[Series[1/(1-x)*Sum[ i/(1+x^2^(i-1))*Product[1+x^2^j,{j,0,i-2}],{i,n}],{x,0,2^n-1}],x],{0}]; Array[row,6,0] (* Stefano Spezia, Dec 23 2023 *)
  • Python
    def row_gen(n):
        x = 0
        for k in range(2**n):
            b = bin(k)[2:].zfill(n)
            x += sum((-1)**(int(b[n-i])+1)*i for i in range(1,n+1))
            yield(-x)
    def A367076_row_n(n): return(list(row_gen(n)))

Formula

T(n,k) = Sum_{i=0..n} abs(k + 1 - (2^i) * round((k+1)/2^i)) * i.
G.f. for n-th row: 1/(1-x) * Sum_{i=1..n} (i/(1+x^2^(i-1)) * Product_{j=0..i-2} 1 + x^2^j).
Showing 1-8 of 8 results.