login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A342157 Base-10 numbers m such that k*m = d||d||...||d (here || appears k-1 times), where k is the length of m, d is any m's digit and || represents concatenation. 0

%I #18 Apr 08 2021 13:57:27

%S 0,1,2,3,4,5,6,7,8,9,148,185,148148

%N Base-10 numbers m such that k*m = d||d||...||d (here || appears k-1 times), where k is the length of m, d is any m's digit and || represents concatenation.

%C All numbers satisfying such conditions must be smaller than 10^9, because if we take any 10-digit number m, 10m is an 11-digit number while d||d||...||d is a 10-digit number.

%C 148 and 148148 are the only numbers in the sequence for which d is not necessarily the last digit (for 148 we take d=4, which is the second digit of 148 and for 148148 we take d=8, which is the last, but also the third digit).

%e m=148 is in the sequence, because if we multiply 148 by k=3 (length of 148) we obtain 444, which is d||d||d for d=4 (second digit of 148)

%o (C++)

%o #include <iostream>

%o #include <math.h>

%o using namespace std;

%o int length(int a){for(int i=0; i<=10; i++){if(pow(10,i)<=a && pow(10,i+1)>a){return i+1;}}}

%o int DC(int a, int b){int c=(a%(int)(pow(10,b))-a%(int)(pow(10,b-1)))/(int)(pow(10,b-1));int l=length(a);int s=0;for(int i=0; i<l; i++){s=s+(int)(pow(10,i));}return s*c;}

%o int main() {for(int n=1; n<pow(10,9); n++){int k=length(n);for(int i=1; i<=k; i++){if(k*n==DC(n,i)){cout<<n<<endl;}}}}

%K nonn,base,fini,full

%O 1,3

%A _Andrzej Kukla_, Mar 02 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 06:34 EDT 2024. Contains 371265 sequences. (Running on oeis4.)