login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A323422 Multiples of three whose sum of digits is not divisible by 3 until the final digit. 1
0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 42, 45, 48, 51, 54, 57, 72, 75, 78, 81, 84, 87, 102, 105, 108, 111, 114, 117, 132, 135, 138, 141, 144, 147, 162, 165, 168, 171, 174, 177, 192, 195, 198, 201, 204, 207, 222, 225, 228, 231, 234, 237, 252, 255, 258, 261, 264, 267, 282, 285, 288, 291, 294, 297 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

An integer is a member if, when its digits are added from left to right, the sum is divisible by 3 only when all the digits have been added.

If m is in the sequence then so is m1 = m + 3*10^k and m1 and m have the same number of digits such that the addition gives no carries. For example, 12 is in the sequence so is 12 + 30 = 42 as there is no carry and 12 and 42 have the same number of digits.

LINKS

Cyril Naud, Table of n, a(n) for n = 1..9999

EXAMPLE

117 is a term because the consecutive sums are 1, 2(=1+1), 9(=1+1+7) : only the last sum is divisible by 3.

123 is not a term because 1+2 is divisible by 3.

PROG

(JavaScript)

var i=0, sequence=[];

while(true)

{

var i_str=i.toString();

var digits=[];

for(var j=0; j<is.length; j++)

digits.push(parseInt(i_str.charAt(j)));

var sum=0, ok=true;

for(var k=0; k<digits.length; k++)

{

sum+=digits[k];

if((sum%n==0&&k<digits.length-1)||(sum%n!=0&&k==digits.length-1))

  ok=false

}

if(ok)

sequence.push(i);

  i++;

}

(PARI) is(n) = if(n / 3 != n \ 3, return(0)); my(d = digits(n), s = 0); for(i = 1, #d - 1, s += d[i]; if(s % 3 == 0, return(0))); 1 \\ David A. Corneth, Jan 14 2019

CROSSREFS

Subsequence of A008585.

Sequence in context: A085126 A190083 A117124 * A071073 A329844 A127451

Adjacent sequences:  A323419 A323420 A323421 * A323423 A323424 A323425

KEYWORD

nonn,base,easy

AUTHOR

Cyril Naud, Jan 14 2019

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 16:31 EDT 2021. Contains 347598 sequences. (Running on oeis4.)