login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A242924 Position of first occurrence of n in A242923. 1

%I #16 Nov 23 2020 14:21:28

%S 1,2,4,8,12,66,24,34,233,251,284,173,104,299,329,431,596,625,528,1052,

%T 759,349,667,1028,793,436,1242,1882,1410,1374,4974,1181,3626,3517,

%U 3673,3148,4398,6160,5537,4254,5512,7039,4074,2194,10206,11361,4154,12710,7559

%N Position of first occurrence of n in A242923.

%C Not currently known to be finite for all n.

%H Alois P. Heinz, <a href="/A242924/b242924.txt">Table of n, a(n) for n = 1..200</a>

%p b:= proc(n) option remember; local i, t, ok;

%p if n<2 then n

%p else for t from 1 +b(n-1) do ok:=true;

%p for i to n/2 while ok

%p do ok:= b(n-2*i)+t <> 2*b(n-i) od;

%p if ok then return t fi

%p od

%p fi

%p end:

%p a:= proc() local t, a; t, a:= 0, proc() 0 end;

%p proc(n) local h;

%p while a(n) = 0 do

%p t:= t+1; h:= b(t) -b(t-1);

%p if a(h) = 0 then a(h):= t fi

%p od; a(n)

%p end

%p end():

%p seq(a(n), n=1..30); # _Alois P. Heinz_, May 26 2014

%t nmaxb = 2000; (* max index of b(n) *)

%t nmaxa = 30; (* max index of a(n) *)

%t b[n_] := b[n] = Module[{i, t, ok}, If[n < 2, n, For[t = 1 + b[n - 1], True, t++, ok = True; For[i = 1, i <= n/2 && ok, i++, ok = b[n - 2 i] + t != 2 b[n - i]]; If[ok, Return[t]]]]];

%t B = Array[b, nmaxb] // Differences;

%t a[n_] := a[n] = Module[{p = FirstPosition[B, n]}, Which[n == 1, 1, p === Missing["NotFound"], -1, True, p[[1]] + 1]];

%t Array[a, nmaxa] (* _Jean-François Alcover_, Nov 23 2020, after _Alois P. Heinz_ for b(n) *)

%Y Cf. A242921, A242923.

%K nonn

%O 1,2

%A _Jeffrey Shallit_, May 26 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)