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!)
A330931 Numbers k such that both k and k + 1 are Niven numbers in base 2 (A049445). 30

%I #22 Mar 17 2024 07:33:34

%S 1,20,68,80,115,155,184,204,260,272,284,320,344,355,395,404,424,464,

%T 555,564,595,623,624,636,664,675,804,835,846,847,864,875,888,904,972,

%U 1028,1040,1075,1088,1124,1164,1182,1211,1224,1239,1266,1280,1304,1315,1424

%N Numbers k such that both k and k + 1 are Niven numbers in base 2 (A049445).

%C Cai proved that there are infinitely many runs of 4 consecutive Niven numbers in base 2. Therefore this sequence is infinite.

%D József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 4, p. 382.

%H Amiram Eldar, <a href="/A330931/b330931.txt">Table of n, a(n) for n = 1..10000</a>

%H Tianxin Cai, <a href="https://www.fq.math.ca/Scanned/34-2/cai1.pdf">On 2-Niven numbers and 3-Niven numbers</a>, Fibonacci Quarterly, Vol. 34, No. 2 (1996), pp. 118-120.

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Harshad_number">Harshad number</a>.

%H Brad Wilson, <a href="http://www.fq.math.ca/Scanned/35-2/wilson.pdf">Construction of 2n consecutive n-Niven numbers</a>, Fibonacci Quarterly, Vol. 35, No. 2 (1997), pp. 122-128.

%e 20 is a term since 20 and 20 + 1 = 21 are both Niven numbers in base 2.

%t binNivenQ[n_] := Divisible[n, Total @ IntegerDigits[n, 2]]; bnq1 = binNivenQ[1]; seq = {}; Do[bnq2 = binNivenQ[k]; If[bnq1 && bnq2, AppendTo[seq, k - 1]]; bnq1 = bnq2, {k, 2, 10^4}]; seq

%o (Magma) f:=func<n|n mod &+Intseq(n,2) eq 0>; a:=[]; for k in [1..1500] do if forall{m:m in [0..1]|f(k+m)} then Append(~a,k); end if; end for; a; // _Marius A. Burtea_, Jan 03 2020

%o (Python)

%o def sbd(n): return sum(map(int, str(bin(n)[2:])))

%o def niv2(n): return n%sbd(n) == 0

%o def aupto(nn): return [k for k in range(1, nn+1) if niv2(k) and niv2(k+1)]

%o print(aupto(1424)) # _Michael S. Branicky_, Jan 20 2021

%Y Cf. A049445, A328205, A328209, A328213, A330713, A330927, A330932, A330933.

%K nonn,base

%O 1,2

%A _Amiram Eldar_, Jan 03 2020

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 April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)