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

A309567 a(1) = 4, a(2) = 2, a(3) = 5, a(4) = 3, a(5) = 1; a(n) = a(n-a(n-1)) + a(n-a(n-4)) for n > 5.

Original entry on oeis.org

4, 2, 5, 3, 1, 4, 7, 5, 8, 6, 4, 12, 5, 13, 6, 9, 17, 5, 18, 6, 9, 22, 5, 23, 11, 9, 27, 5, 28, 11, 9, 32, 5, 33, 11, 14, 37, 5, 38, 11, 14, 42, 5, 43, 11, 14, 47, 5, 48, 16, 14, 52, 5, 53, 16, 14, 57, 5, 58, 16, 14, 62, 5, 63, 16, 19, 67, 5, 68, 16, 19, 72, 5, 73, 16, 19, 77, 5, 78, 16, 19, 82, 5, 83, 21, 19, 87, 5
Offset: 1

Views

Author

Altug Alkan and Rémy Sigrist, Aug 08 2019

Keywords

Comments

A well-defined quasi-periodic solution for Hofstadter V recurrence (a(n) = a(n-a(n-1)) + a(n-a(n-4))).

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,j;
      j:= n mod 5;
      k:= (n-j)/5;
      if j=0 then 5*floor(sqrt(k-1))+1
      elif j=1 then 5*round(sqrt(k))-1
      elif j=2 then 5*k+2
      elif j=3 then 5
      else 5*k+3
      fi
    end proc:
    f(1):= 4:
    map(f, [$1..100]); # Robert Israel, Aug 08 2019
  • Mathematica
    a[n_] := a[n] = If[n < 6, {4, 2, 5, 3, 1}[[n]], a[n - a[n-1]] + a[n - a[n-4]]]; Array[a, 88] (* Giovanni Resta, Aug 08 2019 *)
  • PARI
    q=vector(100); q[1]=4; q[2]=2; q[3]=5; q[4]=3; q[5]=1; for(n=6, #q, q[n]=q[n-q[n-1]]+q[n-q[n-4]]); q

Formula

For k >= 1:
a(5*k) = 5*floor(sqrt(k-1))+1,
a(5*k+1) = 5*round(sqrt(k))-1,
a(5*k+2) = 5*k+2,
a(5*k+3) = 5,
a(5*k+4) = 5*k+3.

A309636 a(1) = 3, a(2) = 1, a(3) = 4, a(4) = 2, a(5) = 5; a(6) = 3; a(n) = a(n-a(n-1)) + a(n-a(n-4)) for n > 6.

Original entry on oeis.org

3, 1, 4, 2, 5, 3, 6, 4, 7, 10, 8, 6, 9, 7, 10, 13, 6, 14, 12, 10, 18, 6, 14, 17, 10, 23, 11, 14, 22, 10, 28, 16, 14, 27, 10, 33, 16, 14, 32, 10, 38, 16, 19, 37, 10, 43, 16, 24, 42, 10, 48, 16, 24, 47, 10, 53, 16, 24, 52, 10, 58, 16, 24, 57, 10, 63, 21, 24, 62, 10, 68, 26, 24, 67, 10
Offset: 1

Views

Author

Altug Alkan and Nathan Fox, Aug 10 2019

Keywords

Comments

A well-defined quasi-periodic solution for Hofstadter V recurrence (a(n) = a(n-a(n-1)) + a(n-a(n-4))).

Crossrefs

Programs

  • Magma
    I:=[3,1,4,2,5,3]; [n le 6 select I[n] else  Self(n-Self(n-1)) + Self(n-Self(n-4)): n in [1..80]]; // Marius A. Burtea, Aug 11 2019
  • Mathematica
    Nest[Append[#, #[[-#[[-1]] ]] + #[[-#[[-4]] ]]] &, {3, 1, 4, 2, 5, 3}, 69] (* Michael De Vlieger, May 08 2020 *)
  • PARI
    q=vector(100); q[1]=3; q[2]=1; q[3]=4; q[4]=2; q[5]=5; q[6]=3; for(n=7, #q, q[n] = q[n-q[n-1]] + q[n-q[n-4]]); q
    

Formula

For k > 1:
a(5*k) = 10,
a(5*k+1) = 5*k-2,
a(5*k+2) = 5*(floor((sqrt(2*k-1)-1)/2) + floor((sqrt(2*k-3)-1)/2)) + 6,
a(5*k+3) = 5*(floor(sqrt(k/2)) + floor(sqrt((k-1)/2))) + 4,
a(5*k+4) = 5*k-3.
Also, a(5*k+2) = 5*f(k)+1 and a(5*k+3) = 5*g(k)-1 where f(k) = g(k-g(k-1)) and g(k) = f(k-f(k))+2 with f(1) = g(1) = 1, g(2) = 2.
Showing 1-2 of 2 results.