This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A258083 #40 Dec 23 2024 14:53:44 %S A258083 21,12,3,24,15,6,27,18,9,210,111,312,213,114,315,216,117,318,219,120, %T A258083 321,222,123,324,225,126,327,228,129,30,231,132,33,234,135,36,237,138, %U A258083 39,240,141,42,243,144,45,246,147,48,249,150,51,252,153,54,255,156 %N A258083 Smallest multiple of 3 not appearing earlier that ends with n. %C A258083 a(10*n) = 10*a(n). %C A258083 The sequence is a permutation of the positive multiples of 3. - _Vladimir Shevelev_, May 24 2015 %C A258083 24 ends with 24 but as 24 is the least element divisible by 3 that ends with 4, it's already used and a(24) = 324. Generally, a(n) = k * 10^d + n with k in {0,1,2,3} and d the number of digits of n. - _David A. Corneth_, May 24 2015 %C A258083 A258225(n) = a(n) / 3 is a permutation of the positive integers. - _Reinhard Zumkeller_, May 27 2015 %H A258083 Reinhard Zumkeller, <a href="/A258083/b258083.txt">Table of n, a(n) for n = 1..9999</a> %H A258083 Éric Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2015-May/014895.html">Multiples of 3 ending with n</a>, SeqFan list, May 23 2015. %t A258083 a[n_] := a[n] = For[k=3, True, k=k+3, If[Divisible[k-n, 10^IntegerLength[n] ] && FreeQ[Array[a, n-1], k], Return[k]]]; Array[a, 56] (* _Jean-François Alcover_, Feb 06 2018 *) %o A258083 (Haskell) %o A258083 import Data.List (isPrefixOf, delete) %o A258083 a258083 n = a258083_list !! (n-1) %o A258083 a258083_list = f 1 $ tail $ zip %o A258083 a008585_list $ map (reverse . show) a008585_list where %o A258083 f x ws = g ws where %o A258083 g ((u, vs) : uvs) = if isPrefixOf xs vs %o A258083 then u : f (x + 1) (delete (u, vs) ws) else g uvs %o A258083 xs = reverse $ show x %o A258083 (PARI) a(n) = {my(d = digits(n), s = vecsum(d), k); if(s%3 > 0,k = (3 - s%3)%3, i=1; while(i < #d && d[i] == 3,i++); if(i<#d && d[i+1] >= 1 && d[i]-1 == bitand(d[i]-1, 1), k = 3)); k*10^#d + n} \\ _David A. Corneth_, May 24 2015 %Y A258083 Cf. A008585, A258188, A258217, A258225. %K A258083 nonn,base,look,hear %O A258083 1,1 %A A258083 _Eric Angelini_ and _Reinhard Zumkeller_, May 23 2015