a030099.rkt

#399
Raw
Author
winny
Created
Oct. 15, 2021, 7:55 a.m.
Expires
Never
Size
659 bytes
Hits
321
Syntax
Racket
Private
No
#lang racket

(define a030099
  (for/stream ([k (in-naturals)]
               #:when (let loop ([n (expt k 3)])
                        (define-values (q r) (quotient/remainder n 10))
                        (and (odd? r) (or (zero? q) (loop q)))))
    k))

(module+ test
  (require rackunit)
  (check-equal? (stream->list (stream-take a030099 39))
                '(1 11 15 33 39 71 91 173 175 179
                  211 259 335 3337 4631 5597 7353 12415 21353 22893
                  25799 69491 110011 124975 199831 227353 237151 462815 492415 708415 1100033
                  2393695 2620611 5088493 5828415 7204417 8320335 11164415 11689633)))