# Nested sequence evaluation seems to fail [closed]

I tried do define two OIES Sequences like that:

A035327[n_]:=ResourceFunction["OEISSequence"]["A035272"][[n]]
A360142[n_]:=ResourceFunction["OEISSequence"]["A360142"][[n]]


So the argument n takes the corresponding Part of the sequence List

But then

A035327[A360142[1]]


returns

List


If not "nested" it works fine.

What am I doing wrong?

• It looks like A035327[0] isn't defined! Mar 3 at 11:03
• Darn! Iam sorry, too stupid!! Shall I delete the question? Mar 3 at 11:10
• Let the community decide. It will be very likely closed. But as for deleted, I'm not so sure. Mar 3 at 11:12

# Explanation

It's not about nesting, it's about the argument. You are doing {a,b,c}[[0]].

ResourceFunction["OEISSequence"]["A360142"]
(* {0,1,2,2,4,5,8,9,10,17,18,18,20,35,36,37,40,69,73,74,81,138,145,146,146,148,163,276,291,292,293,296,325,553,582,585,586,593,650,1105,1162,1169,1170,1172,1187,1300,2211,2324,2339,2340,2341,2344,2373,2601} *)

A360142[1]
(* 0 *)


So

A035327[A360142[1]]


is the same as

A035327[0]


Part zero of any expression is its Head

Therefore,

A035327[0]
(* List *)


As well as

{0,1,2,2,4,5}[[0]]
(* List *)


# Solution

ClearAll[A035327,A360142,A035272];
A035272[n_Integer?17>=n>=1] := ResourceFunction["OEISSequence"]["A035272"][[n]]
A360142[n_Integer?54>=n>=1] := ResourceFunction["OEISSequence"]["A360142"][[n]]

• Yeah thanks a lot, how embarassing!! Mar 3 at 11:11
• @RaphaelJ.F.Berger not embarrassing we all make mistakes, in my case, many times a day. In the future try debugging with Echo and Trace. Mar 3 at 11:13