Generate the sequence a(n) when each element is the minimum integer multiple m such that the digit sum of n times m is equal to n.



Task
 Find the first 40 elements of the sequence.


Stretch
 Find the next 30 elements of the sequence.


See also
 OEIS:A131382 - Minimal number m such that Sum_digits(n*m)=n




#!/usr/bin/perl
 
use strict; # https://rosettacode.org/wiki/Minimum_multiple_of_m_where_digital_sum_equals_m
use warnings;
use ntheory qw( sumdigits );
 
my @answers = map
  {
  my $m = 1;
  $m++ until sumdigits($m*$_) == $_;
  $m;
  } 1 .. 70;
print "@answers\n\n" =~ s/.{65}\K /\n/gr;