login
A140948
a(0) = 3; for n >= 1, if a(n-1) = 2*k, then a(n) = k, otherwise 1 + (A065091(n)*a(n-1)), where A065091(n) gives the n-th odd prime.
1
3, 10, 5, 36, 18, 9, 154, 77, 1772, 886, 443, 16392, 8196, 4098, 2049, 108598, 54299, 3312240, 1656120, 828060, 414030, 207015, 17182246, 8591123, 833338932, 416669466, 208334733, 22291816432, 11145908216, 5572954108, 2786477054, 1393238527, 190873678200, 95436839100, 47718419550, 23859209775
OFFSET
0,1
COMMENTS
The original name of the sequence: P-adic Hailstone (or A033478): instead of 3, Prime[n] is used: a(n)=If[Mod[a(n - 1), 2] == 0, a(n - 1)/2, Prime(n + 1)*a(n - 1) + 1].
REFERENCES
C. Pickover, Mazes for the Mind, St. Martin's Press, NY, 1992, p. 203-204.
LINKS
FORMULA
a(n) = If[Mod[a(n - 1), 2] == 0, a(n - 1)/2, Prime(n + 1)*a(n - 1) + 1].
a(0) = 3; for n >= 1, if a(n-1) = 2*k, then a(n) = k, otherwise 1 + (A065091(n)*a(n-1)). - Antti Karttunen, Jan 29 2016 after the Mathematica-code above and the original name of the sequence.
MATHEMATICA
a[0] = 3; a[n_] := a[n] = If[Mod[a[n - 1], 2] == 0, a[n - 1]/2, Prime[n + 1]*a[n - 1] + 1]; Table[a[n], {n, 0, 30}]
PROG
(Scheme, with memoization-macro definec)
(definec (A140948 n) (cond ((zero? n) 3) ((even? (A140948 (- n 1))) (/ (A140948 (- n 1)) 2)) (else (+ 1 (* (A065091 n) (A140948 (- n 1)))))))
;; Antti Karttunen, Jan 29 2016
CROSSREFS
Sequence in context: A285576 A246777 A111127 * A328763 A281174 A281220
KEYWORD
nonn
AUTHOR
EXTENSIONS
Offset corrected, name changed and more terms added by Antti Karttunen, Jan 29 2016
STATUS
approved