%I #9 Jul 19 2021 01:20:08
%S 17,21,25,42,63,84,143,286,2355,5821,6618,11709,12482,33747,39571,
%T 129109,466957,1162248,1565166,1968084,3636638,3853951,4898376,
%U 6065280,13443745,13933175,17118698,22421197,24153462377
%N Inrepfigit (INverse REPetitive FIbonacci-like diGIT) numbers (or Htiek numbers).
%C This sequence is similar to A007629 (Keith numbers). It consists of the numbers n>9 with the following property: n is a term of the sequence S whose first k terms are the k digits of n (with the first term equal to the units digit) and with S(n+1)=sum of the k previous terms.
%e 42 is in the sequence because the terms of the sequence it creates are 2, 4, 6, 10, 16, 26, 42, ...
%t iKeithQ[n_Integer] := Module[{b = Reverse[IntegerDigits[n]], s, k = 0}, s = Total[b]; While[s < n, AppendTo[b, s]; k++; s = 2*s - b[[k]]]; s == n]; Select[Range[10, 100000], iKeithQ] (* _T. D. Noe_, Mar 15 2011 *)
%o Here is a (messy) C++ code which finds the terms of the sequence below 100000000
%o #include <stdio.h>
%o int main()
%o {
%o int k2;
%o for ( int k = 10 ; k < 100000000 ; k++ )
%o {
%o k2 = k;
%o int array [9];
%o for ( int i = 0 ; i <= 8; i++ )
%o {
%o array[i] = k2 % 10;
%o k2 /= 10;
%o }
%o bool c = true;
%o int check=8;
%o for ( int i = 0; i <=8; i++ )
%o {
%o if ((array[8-i]==0)&&c)
%o check--;
%o else
%o c=false;
%o }
%o bool b = false;
%o int n = 0;
%o while ( n <= k && !b )
%o {
%o n = 0;
%o for ( int i = 0; i <= check; i++ )
%o n += array[i];
%o if ( n == k )
%o b = true;
%o for ( int i = 0 ; i < check ; i++ )
%o array[i] = array[i+1];
%o array[check] = n;
%o }
%o if ( b )
%o printf("%d
%o ", k);
%o }
%o return 0;
%o }
%Y Cf. A007629.
%Y Cf. A097060 (reverse of these numbers).
%K base,nonn
%O 1,1
%A Pierre Karpman (pierre.karpman(AT)laposte.net), Oct 23 2007
|