[go: up one dir, main page]

login
Search: a075002 -id:a075002
     Sort: relevance | references | number | modified | created      Format: long | short | data
a(n) is the smallest multiple of n formed by the concatenation 1,2,3,...,k for some k.
+10
1
1, 12, 12, 12, 12345, 12, 1234567891011, 123456, 12345678, 12345678910, 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106, 12
OFFSET
1,2
LINKS
FORMULA
a(n) is the smallest multiple of n appearing in A007908.
EXAMPLE
a(3) = 12, because 12 is the smallest multiple of 3 that appears in A007908.
MAPLE
f:= proc(n) local x, i;
x:= 0;
for i from 1 do
x:= x*10^(1+ilog10(i))+i;
if x mod n = 0 then return x fi
od
end proc:
map(f, [$1..20]); # Robert Israel, Oct 25 2020
MATHEMATICA
smn[n_]:=Module[{k=1, c=1}, While[!Divisible[c, n], k++; c= c*10^IntegerLength[ k]+ k]; c]; Array[ smn, 20] (* Harvey P. Dale, Apr 04 2022 *)
PROG
(PARI) a(n) = j=""; for(k=1, oo, j=eval(concat(Str(j), k)); if(j%n==0, return(j)))
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Eder Vanzei, Sep 09 2020
STATUS
approved
Minimum number of consecutive positive integers starting with 1 that must be concatenated in descending order so that n divides the concatenation, or zero if n divides no such concatenation.
+10
0
1, 0, 2, 0, 0, 0, 2, 0, 8, 0, 14, 0, 15, 0, 0, 0, 9, 0, 5, 0, 2, 0, 16, 0, 0, 0, 26, 0, 4, 0, 25, 0, 14, 0, 0, 0, 21, 0, 15, 0, 40, 0, 67, 0, 0, 0, 78, 0, 54, 0, 9, 0, 66, 0, 0, 0, 5, 0, 25, 0, 111, 0, 44, 0, 0, 0, 161, 0, 18, 0, 49, 0, 30, 0, 0, 0, 73, 0, 15, 0, 27, 0, 27, 0, 0, 0, 41, 0, 20, 0, 54, 0, 47, 0, 0, 0, 63, 0, 18, 0, 98, 0, 102, 0, 0, 0, 3, 0, 99, 0, 21
OFFSET
1,3
COMMENTS
a(n) = 0 if n is even or a multiple of 5. Empirical observation: a(n) > 0 for all other n values.
EXAMPLE
For n=19 the a(19)=5 since 54321 = 19*2859, while 4321, 321, 21 and 1 are not multiples of 19.
MATHEMATICA
Table[If[GCD[n, 10] == 1, Block[{k = 1}, While[Mod[FromDigits@ Flatten@ Map[IntegerDigits, Range[k, 1, -1]], n] != 0, k++]; k], 0], {n, 111}] (* Michael De Vlieger, Aug 02 2018 *)
PROG
(Pascal)
program skaitlirinda2;
var i : longint;
function Atrodi(n : longint) : int64;
var sk, koefa, naksk, rez : int64;
begin
sk := 1;
naksk := 10;
koefa := naksk mod n;
rez := sk mod n;
while rez>0 do
begin
Inc(sk);
rez := (sk * koefa + rez) mod n;
if sk=naksk then naksk := naksk * 10;
koefa := (koefa*naksk) mod n;
end;
Atrodi := sk;
end;
begin
for i:=1 to 10000 do
begin
if (i mod 2)*(i mod 5) > 0 then writeln(i, ' ', Atrodi(i)) else writeln(i, ' 0');
end;
end.
(PARI) a(n) = {if ((n%2) && (n%5), my(s = ""); for (k=1, oo, s = concat(Str(k), s); if (!(eval(s) % n), return (k)); ); ); return (0); } \\ Michel Marcus, Aug 02 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Martins Opmanis, Aug 02 2018
STATUS
approved

Search completed in 0.006 seconds