[seqfan] Re: Haverbeke's 1 plus 5 or times 3 problem

Neil Sloane njasloane at gmail.com
Fri Jun 5 04:40:35 CEST 2020

This is a type of sequence where we already have a number of examples
(although not that one). For example:

%N A121538 Increasing sequence: "if n appears then a*n+b doesn't", case
a(1)=1, a=2, b=1.
%C A121539 Equivalently, increasing sequence defined by: "if n appears
a*n+b does not", case a(1)=0, a=2, b=1.
%N A121540 Increasing sequence: "if n appears a*n+b does not", case a(1)=3,
a=2, b=1.
%N A121541 Increasing sequence: "if n appears a*n+b does not", case a(1)=4,
a=2, b=1.
%N A121542 Increasing sequence: "if n appears a*n+b does not", case a(1)=5,
a=2, b=1.
%C A003159 If n appears then 2n does not.
%N A005658 If n appears so do 2n, 3n+2, 6n+3.
%N A005659 If n appears so do 2n-2 and 3n-3.
%N A005660 If n appears so do 2n+2 and 3n+3.
%N A005662 If n appears then so do 2n+2 and 3n+3.
%C A022342 If n appears, n + (rank of n) does not (10 is the 7th term in
the sequence but 10 + 7 = 17 is not a term of the sequence). - _Benoit
Cloitre_, Jun 18 2002
%C A028260 If n appears, p*n does not (p primes). - _Philippe Deléham_, Jun
10 2006
%C A036668 If n appears then 2n and 3n do not. - _Benoit Cloitre_, Jun 13
%N A121537 If n appears then 2n, 3n and 4n do not.
%N A121543 "If n appears then n-th prime doesn't", with a(1)=1.

Besides your A335365, could you also submit "If n appears then so do n+5
and 3*n",  for completeness, even though it is very dense ?
I guess it begins
1, 3, 6, 8, 9, 11, 13, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 29, 31, ...

On Thu, Jun 4, 2020 at 9:56 PM Alonso Del Arte <alonso.delarte at gmail.com>

> To illustrate recursive functions in *Eloquent JavaScript*, Marijn
> Haverbeke posits the following problem: start from 1, then either add 5 or
> multiply by 3. Repeat one or the other or alternate in whatever pattern you
> want. Some numbers, like 13, can be reached in at least one way. Others,
> like 15, are unreachable. Write a JavaScript function to find a solution
> for a given number; it doesn't have to be the "best" solution, it simply
> has to be *a* solution, if it exists for the particular number.
> Maybe Haverbeke's the first to connect this mathematical problem to
> JavaScript, but I doubt he's the one who first formulated it. Although it's
> also possible that he remembered a similar problem and intentionally or
> unintentionally changed it to suit his purpose. Though I doubt anyone
> before me has explored the variant starting with −1, which I'm not ready to
> say anything more about at this time.
> As usual for problems of this sort, the first reference to consult is the
> OEIS. My searches got lots of results, but in this instance I suspect they
> were often irrelevant matches, and a demonstration of the law of small
> numbers.
> Haverbeke bibliographic citation and link to Scastie snippet currently at
> https://oeis.org/draft/A335365
> My question to y'all: have you ever heard of this problem before, or a
> similar problem?
> Al
> --
> Alonso del Arte
> Author at SmashWords.com
> <https://www.smashwords.com/profile/view/AlonsoDelarte>
> Musician at ReverbNation.com <http://www.reverbnation.com/alonsodelarte>
> --
> Seqfan Mailing list - http://list.seqfan.eu/

More information about the SeqFan mailing list