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.

A329596 A variation of Recamán's sequence (A005132): a(0) = 0; a(1) = 1; a(2) = 3; for n > 2, a(n) = sopfr(a(n-1))- sopfr(n) if positive and not already in the sequence, otherwise a(n) = sopfr(a(n-1)) + sopfr(n).

This page as a plain text file.
%I A329596 #39 Dec 09 2019 23:05:43
%S A329596 0,1,3,6,9,11,16,15,2,8,13,24,16,21,19,27,17,34,27,28,20,19,32,33,5,
%T A329596 15,23,14,20,38,31,62,43,29,10,19,29,66,37,53,42,53,41,84,29,18,33,61,
%U A329596 50,26,27,29,12,60,23,7,20,31,62,92,39,77,51,33,26,33,30,77,39,42
%N A329596 A variation of Recamán's sequence (A005132): a(0) = 0; a(1) = 1; a(2) = 3; for n > 2, a(n) = sopfr(a(n-1))- sopfr(n) if positive and not already in the sequence, otherwise a(n) = sopfr(a(n-1)) + sopfr(n).
%C A329596 On the graph it seems that there are lines where the density of points is higher than elsewhere. These lines correspond to those which are easily observable on A001414. Up to n=100000 there are 13413 prime numbers in this sequence while at A001414 there are 21877; surely the primes are distributed differently in these sequences.
%C A329596 Regarding the MATLAB code: factor(0)=sum(factor(0))=0 and factor(1)=sum(factor(1))=1, this can be very misleading, attention needed during using sum(factor(n)) as sopfr(n).
%H A329596 Bence Bernáth, <a href="/A329596/b329596.txt">Table of n, a(n) for n = 0..10000</a>
%H A329596 Bence Bernáth, <a href="/A329596/a329596.txt">Table of n, a(n) for n = 0..200000</a>
%H A329596 Michael De Vlieger, <a href="/A329596/a329596.png">First 65 terms drawn as a spiral</a>, akin to the Harriss drawing at A005132.
%H A329596 Michael De Vlieger, video of <a href="https://youtu.be/YWbg_dZX8Ow">first 128 steps of this sequence</a>, with audio accompaniment generated by aspects of the sequence. Nov 19, 2019.
%e A329596 a(3)=6, factor(6)=[2 3], sum of factor(6) is 5. Then n=4, sum of factor(4) is 2+2=4. 5-4 = 1 but 1 is already in the sequence so a(4)=5+4=9.
%t A329596 Block[{f}, f[n_] := Total@ Flatten[ConstantArray[#1, #2] & @@@ FactorInteger[n]]; Nest[Append[#1, If[And[#3 >= 0, FreeQ[#1, #3]], #3, f@ #1[[-1]] + f@ #2]] & @@ {#1, #2, f@ #1[[-1]] - f@#2} & @@ {#, Length@ #} &, {0}, 69] ] (* _Michael De Vlieger_, Nov 19 2019 *)
%o A329596 (MATLAB)
%o A329596 length_seq=100000;
%o A329596 sequence(1)=0; %sum(factor(0))=0
%o A329596 sequence(2)=1; %sum(factor(1))=1
%o A329596 for i1=2:1:length_seq
%o A329596 if  (sum(factor(sequence(i1)))-sum(factor((i1))))>0 && (ismember((sum(factor(sequence(i1)))-sum(factor((i1)))),sequence)==0)
%o A329596       sequence(i1+1)=(sum(factor(sequence(i1)))-sum(factor((i1))));
%o A329596    else
%o A329596        sequence(i1+1)=(sum(factor(sequence(i1)))+sum(factor((i1))));
%o A329596 end
%o A329596 end
%o A329596 result=transpose(sequence);
%Y A329596 Cf. A001414, A005132.
%K A329596 nonn,easy
%O A329596 0,3
%A A329596 _Bence Bernáth_, Nov 17 2019