|
|
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).
|
|
1
|
|
|
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, 15, 23, 14, 20, 38, 31, 62, 43, 29, 10, 19, 29, 66, 37, 53, 42, 53, 41, 84, 29, 18, 33, 61, 50, 26, 27, 29, 12, 60, 23, 7, 20, 31, 62, 92, 39, 77, 51, 33, 26, 33, 30, 77, 39, 42
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
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.
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).
|
|
LINKS
|
|
|
EXAMPLE
|
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.
|
|
MATHEMATICA
|
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 *)
|
|
PROG
|
(MATLAB)
length_seq=100000;
sequence(1)=0; %sum(factor(0))=0
sequence(2)=1; %sum(factor(1))=1
for i1=2:1:length_seq
if (sum(factor(sequence(i1)))-sum(factor((i1))))>0 && (ismember((sum(factor(sequence(i1)))-sum(factor((i1)))), sequence)==0)
sequence(i1+1)=(sum(factor(sequence(i1)))-sum(factor((i1))));
else
sequence(i1+1)=(sum(factor(sequence(i1)))+sum(factor((i1))));
end
end
result=transpose(sequence);
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|