%I #35 Jun 14 2022 01:43:30
%S 545,27272,1818181,636363636,90909090909,181818181818,272727272727,
%T 363636363636,454545454545,545454545454,636363636363,727272727272,
%U 818181818181,909090909090,363636363636363,81818181818181818,7272727272727272727,454545454545454545454
%N Positive integers k with the property that they cannot be converted to a multiple of 11 by changing at most a single decimal digit.
%C This sequence was inspired by a puzzle from David K. Butler.
%H Ben Weiss, <a href="https://blog.benweiss.com/2022/05/16/multiples-of-11/">Multiples of 11</a>
%F a(n) = a(n - 18) * 10^22 + (a(n - 18) mod 100) * 101010101010101010101.
%o (OBJC)
%o int main(int argc, const char * argv[]) {
%o // Search positive integers for solutions, up to 10^20.
%o for (int length = 1; length < 20; ++length) {
%o for (int a = 0; a <= 9; ++a) {
%o int b = 9 - a;
%o // Test number abababab... with length 'length'
%o int a_mod_11 = (a * ((length + 1) / 2)) % 11;
%o int b_mod_11 = (b * ((length ) / 2)) % 11;
%o int a_add = (b_mod_11 - a_mod_11 + 11) % 11;
%o if (a + a_add == 10) {
%o uint64_t num = 0;
%o uint64_t dec = 1;
%o for (int d = 0; d < length; ++d) {
%o num += ((d & 1) ? b : a) * dec;
%o dec *= 10;
%o }
%o NSLog(@"Found solution: %llu", num);
%o }
%o }
%o }
%o return 0;
%o }
%Y Cf. A008593 (multiples of 11).
%K base,nonn
%O 1,1
%A _Ben Weiss_, May 15 2022
|