login
Numbers such that when the leftmost digit is moved to the unit's place the result is divisible by 8.
4

%I #15 Jul 08 2025 14:14:57

%S 0,8,23,27,42,46,61,65,69,80,84,88,203,207,211,215,219,223,227,231,

%T 235,239,243,247,251,255,259,263,267,271,275,279,283,287,291,295,299,

%U 402,406,410,414,418,422,426,430,434,438,442,446,450,454,458,462,466,470,474

%N Numbers such that when the leftmost digit is moved to the unit's place the result is divisible by 8.

%H Stefano Spezia, <a href="/A385703/b385703.txt">Table of n, a(n) for n = 1..10000</a>

%e 458 is a term since 584 = 73*8 is divisible by 8.

%t Select[Range[0,475],Divisible[FromDigits[RotateLeft[IntegerDigits[#]]],8] &]

%o (PARI) isok(k) = if (k==0, return(1)); my(d=digits(k), v = vector(#d-1, i, d[i+1])); v = concat(v, d[1]); fromdigits(v) % 8 == 0; \\ _Michel Marcus_, Jul 08 2025

%o (Python)

%o def ok(n): return int((s:=str(n))[1:]+s[0])%8 == 0

%o print([k for k in range(500) if ok(k)]) # _Michael S. Branicky_, Jul 08 2025

%Y Similar sequences for k=1..9: A001477, A273892, A008585, A385700, A217398, A385701, A385702, this sequence, A008591.

%K nonn,base,easy

%O 1,2

%A _Stefano Spezia_, Jul 07 2025