# [seqfan] Re: a(n) and n have the same digitsum but no digit in common

Maximilian Hasler maximilian.hasler at gmail.com
Tue Jan 4 14:27:18 CET 2011

```> n =  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
> S = 28,11,12,13,14,15,16,17,18,37, 2, 3, 4, 5, 6, 7, 8, 9,46,38,30,31,41,33,34,35,36, 1,...
>
> S was built using always the smallest integer not yet present in S
> such that a(n) and n have the same digitsum but no digit in common.

Hello ! In view of the 1st term I assume you mean "digital root" and
not "digit sum".
Below what I get for the first 1000 terms.
It seems that we always have : S[n]=k <=> S[k]=n, for example:
S[2011] = 3469,
S[3469] = 2011.

Happy New Year,
Maximilian

dr(n) = while(n>9, n=[1,1]*divrem(n,10));n

{S=[]; for(n=1,999, dn=Set(Vec(Str(n))); drn=dr(n); for(a=1,1e9,
setintersect(dn,Set(Vec(Str(a)))) & next; dr(a)-drn & next;
setsearch(S,a) & next; print1(a", "); S=setunion(S,Set(a));break))}
28, 11, 12, 13, 14, 15, 16, 17, 18, 37, 2, 3, 4, 5, 6, 7, 8, 9, 46,
38, 30, 31, 41, 33, 34, 35, 36, 1, 47, 21, 22, 50, 24, 25, 26, 27, 10,
20, 48, 58, 23, 51, 52, 53, 63, 19, 29, 39, 67, 32, 42, 43, 44, 72,
64, 74, 66, 40, 68, 78, 70, 71, 45, 55, 83, 57, 49, 59, 87, 61, 62,
54, 82, 56, 84, 85, 86, 60, 88, 116, 90, 73, 65, 75, 76, 77, 69, 79,
107, 81, 208, 101, 102, 103, 104, 105, 106, 125, 108, 226, 92, 93, 94,
95, 96, 97, 89, 99, 235, 227, 228, 337, 248, 222, 223, 80, 225, 244,
200, 336, 346, 338, 447, 358, 98, 333, 334, 335, 300, 229, 257, 456,
205, 206, 207, 280, 209, 246, 202, 239, 258, 367, 260, 252, 262, 272,
255, 220, 203, 249, 232, 368, 270, 289, 236, 237, 238, 230, 204, 259,
224, 378, 298, 290, 273, 247, 284, 240, 250, 233, 234, 343, 245, 282,
283, 293, 285, 295, 242, 243, 253, 344, 264, 256, 266, 294, 304, 269,
306, 325, 254, 345, 265, 275, 267, 277, 305, 324, 307, 119, 354, 139,
149, 159, 133, 134, 135, 91, 137, 363, 355, 347, 465, 376, 377, 387,
388, 353, 408, 148, 356, 114, 115, 161, 117, 100, 110, 111, 130, 158,
474, 151, 170, 171, 109, 155, 156, 157, 140, 168, 385, 179, 180, 118,
173, 138, 166, 113, 150, 169, 386, 144, 181, 191, 147, 184, 131, 141,
160, 143, 405, 145, 407, 183, 193, 185, 195, 313, 188, 153, 406, 146,
165, 301, 194, 303, 196, 314, 315, 136, 434, 174, 175, 167, 177, 331,
341, 351, 154, 164, 435, 310, 176, 186, 178, 350, 360, 163, 308, 129,
274, 419, 276, 187, 197, 189, 199, 299, 417, 292, 428, 546, 268, 278,
279, 424, 425, 426, 400, 446, 555, 448, 404, 198, 190, 470, 444, 409,
401, 411, 286, 440, 126, 127, 128, 120, 112, 122, 402, 511, 287, 558,
172, 182, 192, 121, 212, 501, 502, 296, 288, 460, 218, 201, 211, 221,
420, 124, 422, 297, 442, 479, 210, 508, 410, 429, 142, 152, 414, 415,
452, 480, 418, 500, 492, 214, 215, 162, 451, 416, 462, 445, 455, 510,
241, 251, 216, 217, 461, 471, 427, 464, 528, 520, 467, 441, 505, 506,
507, 319, 329, 339, 529, 323, 261, 271, 263, 219, 328, 365, 330, 538,
557, 369, 370, 380, 309, 373, 302, 357, 556, 359, 567, 316, 317, 318,
391, 311, 366, 565, 566, 576, 550, 281, 291, 517, 509, 519, 601, 332,
396, 361, 515, 327, 382, 320, 123, 322, 503, 612, 379, 371, 606, 607,
383, 132, 610, 602, 603, 352, 389, 381, 571, 392, 213, 583, 395, 513,
523, 326, 390, 535, 518, 231, 619, 512, 522, 532, 362, 372, 526, 536,
591, 592, 611, 531, 559, 533, 516, 553, 527, 375, 628, 521, 621, 577,
551, 525, 562, 374, 348, 349, 449, 639, 397, 398, 399, 364, 437, 384,
340, 476, 468, 622, 443, 489, 436, 473, 438, 394, 494, 477, 469, 668,
498, 481, 491, 393, 403, 629, 486, 478, 488, 660, 472, 482, 600, 412,
620, 666, 667, 677, 669, 616, 608, 312, 682, 692, 630, 433, 497, 633,
490, 617, 321, 421, 413, 342, 487, 713, 723, 499, 707, 708, 430, 431,
423, 703, 704, 624, 463, 644, 609, 691, 638, 432, 496, 614, 642, 634,
626, 636, 466, 701, 693, 712, 623, 696, 643, 662, 483, 484, 647, 702,
604, 722, 804, 661, 671, 537, 439, 458, 459, 595, 731, 453, 454, 545,
573, 457, 485, 450, 748, 578, 732, 544, 554, 735, 475, 539, 495, 514,
587, 570, 733, 581, 834, 493, 530, 549, 757, 740, 552, 580, 770, 582,
808, 575, 504, 721, 758, 579, 589, 572, 717, 700, 593, 711, 730, 749,
777, 778, 779, 771, 709, 710, 801, 739, 803, 534, 598, 590, 744, 718,
719, 540, 541, 524, 543, 814, 599, 843, 844, 800, 810, 802, 542, 903,
805, 725, 753, 547, 755, 720, 793, 794, 912, 715, 734, 825, 574, 548,
585, 775, 812, 588, 823, 743, 780, 646, 584, 594, 568, 569, 813, 832,
563, 564, 655, 656, 648, 586, 560, 822, 688, 824, 645, 664, 665, 684,
640, 596, 561, 850, 680, 888, 835, 935, 846, 649, 605, 615, 625, 689,
618, 880, 809, 900, 658, 632, 858, 859, 698, 663, 826, 818, 819, 613,
650, 831, 868, 806, 681, 862, 683, 828, 631, 641, 840, 841, 833, 915,
889, 881, 882, 811, 821, 921, 1003, 635, 654, 853, 845, 855, 694, 830,
651, 652, 653, 699, 925, 944, 909, 901, 902, 930, 904, 905, 1005,
1114, 836, 864, 685, 686, 1002, 1012, 815, 1014, 1006, 674, 657, 676,
659, 597, 679, 752, 924, 637, 737, 675, 766, 695, 705, 670, 797, 933,
934, 746, 747, 919, 767, 714, 697, 716, 690, 745, 953, 756, 1000, 776,
750, 706, 761, 627, 727, 791, 945, 910, 1001, 759, 760, 950, 672, 673,
773, 729, 955, 911, 1011, 724, 923, 906, 772, 917, 774, 937, 920, 741,
742, 914, 942, 754, 971, 792, 973, 929, 939, 751, 1004, 951, 943,
1016, 954, 991, 992, 993, 913, 932, 1023, 736, 764, 765, 946, 956,
966, 922, 941, 726, 763, 1115, 2007, 1036, 1010, 1020, 1021, 1013,
1032, 1015, 1007, 738, 784, 785, 678, 787, 788, 852, 1123, 1124, 783,
838, 848, 687, 877, 860, 762, 2005, 854, 2025, 820, 857, 768, 886,
851, 807, 781, 1034, 1008, 1045, 866, 786, 2002, 878, 816, 817, 728,
1017, 856, 1046, 867, 1111, 887, 861, 871, 782, 837, 883, 1028, 1056,
1030, 842, 870, 1033, 827, 873, 847, 884, 1038, 1066, 1022, 1113,
2023, 1043, 1044, 1018, 1037, 885, 1048, 1031, 1041, 1132, 863, 1035,
865, 1055, 1083, 1084, 1040, 1050, 1024, 1133, 2034, 1054, 1064, 1065,
1102, 1103, 1104, 1042, 1025, 1116, 874, 875, 876, 1057, 1067, 1077,
1051, 1052, 1026,

>
> S is easy to compute by hand... in the beginning... but things quickly
> become messy... Some help would be greatly appreciated!
>
> S is finite: when it comes to n=1023456789 we are stuck for sure. But
> S might stop with an earlier n: what would be the last term of S?
>
> Best,
> É.
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

```