A256393 Start from a(1) = 2, then alternately add either the largest (if n is even), or the smallest (if n is odd) prime factor of the preceding term a(n-1) to get a(n).
2, 4, 6, 9, 12, 15, 18, 21, 24, 27, 30, 35, 40, 45, 48, 51, 54, 57, 60, 65, 70, 77, 84, 91, 98, 105, 108, 111, 114, 133, 140, 147, 150, 155, 160, 165, 168, 175, 180, 185, 190, 209, 220, 231, 234, 247, 260, 273, 276, 299, 312, 325, 330, 341, 352, 363, 366, 427
Offset: 1
Keywords
Links
- Antti Karttunen, Table of n, a(n) for n = 1..4096
- David Sycamore, Tree showing what happens if the initial 2 is replaced by a different prime (Corrected Aug 29 2016)
Crossrefs
Programs
-
Haskell
a256393 n = a256393_list !! (n-1) a256393_list = 2 : zipWith ($) (cycle [a070229, a061228]) a256393_list -- Reinhard Zumkeller, May 06 2015
-
Maple
a[1]:= 2; for n from 2 to 100 do if n::even then a[n]:= a[n-1] + max(numtheory:-factorset(a[n-1])) else a[n]:= a[n-1] + min(numtheory:-factorset(a[n-1])) fi od: seq(a[i],i=1..100); # Robert Israel, May 03 2015
-
Mathematica
f[n_] := Block[{pf = First /@ FactorInteger@ n}, If[EvenQ@ n, Max@ pf, Min@ pf]]; s = {2}; lmt = 58; For[k = 2, k <= lmt, k++, AppendTo[s, s[[k - 1]] + f@ s[[k - 1]]]]; s (* Michael De Vlieger, Apr 19 2015 *) FoldList[Function[f, If[EvenQ@ #2, #1 + First@ f, #1 + Last@ f]][FactorInteger[#1][[All, 1]]] &, Range[2, 59]] (* Michael De Vlieger, Aug 26 2016 *)
-
PARI
lista(nn) = {print1(a = 2, ", "); for (n=2, nn, f = factor(a); if (n % 2, a += f[1, 1], a += f[#f~, 1]); print1(a, ", "););} \\ Michel Marcus, Apr 02 2015
-
Scheme
;; With memoization-macro definec. (definec (A256393 n) (cond ((= 1 n) 2) ((even? n) (+ (A256393 (- n 1)) (A006530 (A256393 (- n 1))))) (else (+ (A256393 (- n 1)) (A020639 (A256393 (- n 1))))))) ;; Antti Karttunen, Apr 18 2015
Formula
Extensions
More terms from Michel Marcus, Apr 02 2015
Replaced the name with more succinct description, moved old name to comments - Antti Karttunen, Apr 18-19 2015
Comments