A375461 Self-consecutive numbers: numbers m such that there exists a nonnegative integer k for which the concatenation of m, m+1, ..., m+k is an m-digit number.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168
Offset: 1
Examples
7 is a term because if we concatenate 7, 8, 9, 10, and 11, we get 7891011, which has 7 digits. 102 is a term because we can concatenate 102 with the next 33 consecutive integers to get a number with 34*3 = 102 digits. 68 is not a term because if we concatenate 68,69,...,100 we get a 67-digit number and concatenating 101 with this yields a 70-digit number, so it is not possible to achieve a 68-digit number.
Links
- Dominic McCarty, Table of n, a(n) for n = 1..10000
Programs
-
JavaScript
function next(m){let d=(""+m).length;if(m*(d+1)
d*(10**d)){return next(10**d)}else{return m+d}}else{if((10**d)%(d+1)==0){return m+1}else{return next(10**d)}}}let m=0;a="";while(m<168){m=next(m);a+=m+", "}console.log(a) // Dominic McCarty, Sep 09 2024 -
Mathematica
SelfConsecutiveQ[n_] := Module[{len = Length@IntegerDigits[n], counter = 1, numDigits = 0}, If[len*(Power[10, len] - n) >= n, Return[Mod[n, len] == 0], numDigits = len*(Power[10, len] - n)]; Mod[n - numDigits, len + 1] == 0 ] Select[Range[1000], SelfConsecutiveQ[#] &]
Comments