OFFSET
1,2
COMMENTS
This is a permutation of natural numbers for the same reason that A266195 and A266351 are. If nothing else works for the value of next a(n), then at least the next unused power of 2 will save the sequence from dying, and will also immediately pick up as its succeeding pair the least term not used so far. This follows because A002487(2^m) = 1 and A002487(2^m * n) = A002487(n) for all n and m.
Still, it would be nice to know when 149 will appear in the sequence.
LINKS
PROG
(Scheme, with defineperm1-macro from Antti Karttunen's IntSeq-library)
(defineperm1 (A266405 n) (cond ((= 1 n) n) (else (let ((prev (A266405 (- n 1)))) (let loop ((k 1)) (cond ((and (not-lte? (A266406 k) (- n 1)) (= (A002487 (* k prev)) (* (A002487 k) (A002487 prev)))) k) (else (loop (+ 1 k)))))))))
(define (A266406 n) (A266405 (- n))) ;; This returns inverse values of A266405 from its hidden cache that defineperm1-macro has prepared. #f is returned for those n that have not yet been encountered.
;; We consider a > b (i.e. not less than b) also in case a is #f.
;; (Because of the stateful caching system used by defineperm1-macro):
(define (not-lte? a b) (cond ((not (number? a)) #t) (else (> a b))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 29 2015
STATUS
approved