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.

A272610 a(1)=5, a(2)=9, a(3)=4, a(4)=6; thereafter a(n) = a(n-a(n-1)) + a(n-a(n-2)).

This page as a plain text file.
%I A272610 #16 Jul 25 2022 04:03:38
%S A272610 5,9,4,6,5,5,18,4,5,10,10,18,4,10,15,10,27,4,15,15,10,36,4,15,20,15,
%T A272610 36,4,20,25,15,45,4,25,25,20,45,4,25,35,15,54,4,35,25,20,72,4,25,40,
%U A272610 25,54,4,40,40,20,72,4,40,35,25,81,4,35,50,25,81,4,50,40,25,117
%N A272610 a(1)=5, a(2)=9, a(3)=4, a(4)=6; thereafter a(n) = a(n-a(n-1)) + a(n-a(n-2)).
%C A272610 In calculating terms of this sequence, use the convention that a(n)=0 for n<=0.
%C A272610 Similar to Hofstadter's Q-sequence A005185 but with different starting values.
%C A272610 This sequence exists as long as A272611 and A272612 exist.
%C A272610 No other term of this sequence changes if a(4) is replaced by a number greater than 6.
%C A272610 If a(2) is replaced by a number N greater than 9, then every other term of the form a(5n+2) is replaced by a(5n+2)*N/9.
%H A272610 Nathan Fox, <a href="/A272610/b272610.txt">Table of n, a(n) for n = 1..10000</a>
%F A272610 a(1)=5, a(2)=9, a(3)=4, a(4)=6; thereafter a(5n)=5*A272611(n), a(5n+1)=5*A272612(n), a(5n+2)=9*A272613(n), a(5n+3)=4, a(5n+4)=5*A272611(n).
%p A272610 A272610:=proc(n) option remember:
%p A272610     if n <= 0 then
%p A272610         return 0:
%p A272610     elif n = 1 then
%p A272610         return 5:
%p A272610     elif n = 2 then
%p A272610         return 9:
%p A272610     elif n = 3 then
%p A272610         return 4:
%p A272610     elif n = 4 then
%p A272610         return 6:
%p A272610     else
%p A272610         return A272610(n-A272610(n-1))+A272610(n-A272610(n-2)):
%p A272610     fi:
%p A272610 end:
%t A272610 a[n_] := a[n] = Switch[n, _?NonPositive, 0, 1, 5, 2, 9, 3, 4, 4, 6, _,
%t A272610    a[n - a[n - 1]] + a[n - a[n - 2]]];
%t A272610 Table[a[n], {n, 1, 80}] (* _Jean-François Alcover_, Jul 24 2022 *)
%o A272610 (Python)
%o A272610 from functools import cache
%o A272610 @cache
%o A272610 def a(n):
%o A272610     if n < 0: return 0
%o A272610     if n < 5: return [0, 5, 9, 4, 6][n]
%o A272610     return a(n - a(n-1)) + a(n - a(n-2))
%o A272610 print([a(n) for n in range(1, 73)]) # _Michael S. Branicky_, Sep 20 2021
%Y A272610 Cf. A005185, A272611, A272612, A272613.
%K A272610 nonn
%O A272610 1,1
%A A272610 _Nathan Fox_, May 03 2016