Skip to main content
fully ungolfed, whitespace
Source Link
erszk
  • 11
  • 3

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun recaman (n) (do*   (series  ; starts as empty list   (i 0 (1+ i))  ; index variable   (last 0 (car s))  ; last number in the series   (low 0 (- last i)))   ((> i n)  ; exit condition   (nreverse series))  ; return value (push  ; loop body   (cond   ((= 0 i) 0)  ; first pass   ((and   (> low 0) (not (find low s)))   low)   (t (+ last i)))   series))) 

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun recaman (n) (do*   (series ; starts as empty list   (i 0 (1+ i))  ; index variable   (last 0 (car s))  ; last number in the series   (low 0 (- last i)))   ((> i n) ; exit condition   (nreverse series))  ; return value (push ; loop body   (cond   ((= 0 i) 0)  ; first pass   ((and (> low 0) (not (find low s))) low)   (t (+ last i)))   series))) 

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun recaman (n) (do* (series  ; starts as empty list (i 0 (1+ i)) ; index variable (last 0 (car s)) ; last number in the series (low 0 (- last i))) ((> i n)  ; exit condition (nreverse series)) ; return value (push  ; loop body (cond ((= 0 i) 0) ; first pass ((and   (> low 0) (not (find low s)))   low) (t (+ last i))) series))) 
fully ungolfed
Source Link
erszk
  • 11
  • 3

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun rrecaman (n) (do* (sseries ; starts as empty list (i 0 (1+ i)) ; index variable (alast 0 (car s)) ; last number in the series (blow 0 (- alast i)))   ((> i n) ; exit condition (nreverse sseries)) ; return value  (push ; loop body (cond ((= 0 i) 0) ; first pass ((and  (> blow 0) (not (find blow s)))   b low) (t (+ alast i))) sseries))) 

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun r(n) (do* (s (i 0 (1+ i)) (a 0 (car s)) (b 0 (- a i))) ((> i n) (nreverse s)) (push (cond ((= 0 i) 0) ((and (> b 0) (not(find b s))) b) (t (+ a i))) s))) 

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun recaman (n) (do* (series ; starts as empty list (i 0 (1+ i)) ; index variable (last 0 (car s)) ; last number in the series (low 0 (- last i)))   ((> i n) ; exit condition (nreverse series)) ; return value  (push ; loop body (cond ((= 0 i) 0) ; first pass ((and  (> low 0) (not (find low s)))    low) (t (+ last i))) series))) 
Source Link
erszk
  • 11
  • 3

Common LISP (139 bytes)

(defun r(n)(do*(s(i 0(1+ i))(a 0(car s))(b 0(- a i)))((> i n)(nreverse s))(push(cond((= 0 i)0)((and(> b 0)(not(find b s)))b)(t(+ a i)))s))) 

Ungolfed:

(defun r(n) (do* (s (i 0 (1+ i)) (a 0 (car s)) (b 0 (- a i))) ((> i n) (nreverse s)) (push (cond ((= 0 i) 0) ((and (> b 0) (not(find b s))) b) (t (+ a i))) s)))