A031975 Erroneous version of A000452.
1, 2, 3, 5, 6, 7, 8, 10, 11, 11, 13, 14, 15, 16, 17, 19, 21, 22, 23, 24, 26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 45, 47, 48, 50, 53
Offset: 1
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
a(9) = 1 + 2 + 3 + 5 + 6 + 7 + 8 + 10 + 11 = 53 is prime.
12 is a term because 12 = 110_3. This sequence regarded as a triangle with rows of lengths 1, 1, 2, 4, 8, 16, ...: 0 1 3, 4 9, 10, 12, 13 27, 28, 30, 31, 36, 37, 39, 40 81, 82, 84, 85, 90, 91, 93, 94, 108, 109, 111, 112, 117, 118, 120, 121 ... - _Philippe Deléham_, Jun 06 2015
a005836 n = a005836_list !! (n-1) a005836_list = filter ((== 1) . a039966) [0..] -- Reinhard Zumkeller, Jun 09 2012, Sep 29 2011
function a(n) m, r, b = n, 0, 1 while m > 0 m, q = divrem(m, 2) r += b * q b *= 3 end r end; [a(n) for n in 0:57] |> println # Peter Luschny, Jan 03 2021
t := (j, n) -> add(binomial(n,k)^j, k=0..n): for i from 1 to 400 do if(t(4,i) mod 3 <>0) then print(i) fi od; # Gary Detlefs, Nov 28 2011 # alternative Maple program: a:= proc(n) option remember: local k, m: if n=1 then 0 elif n=2 then 1 elif n>2 then k:=floor(log[2](n-1)): m:=n-2^k: procname(m)+3^k: fi: end proc: seq(a(n), n=1.. 20); # Paul Weisenhorn, Mar 22 2020 # third Maple program: a:= n-> `if`(n=1, 0, irem(n-1, 2, 'q')+3*a(q+1)): seq(a(n), n=1..100); # Alois P. Heinz, Jan 26 2022
Table[FromDigits[IntegerDigits[k, 2], 3], {k, 60}] Select[Range[0, 400], DigitCount[#, 3, 2] == 0 &] (* Harvey P. Dale, Jan 04 2012 *) Join[{0}, Accumulate[Table[(3^IntegerExponent[n, 2] + 1)/2, {n, 57}]]] (* IWABUCHI Yu(u)ki, Aug 01 2012 *) FromDigits[#,3]&/@Tuples[{0,1},7] (* Harvey P. Dale, May 10 2019 *)
A=vector(100);for(n=2,#A,A[n]=if(n%2,3*A[n\2+1],A[n-1]+1));A \\ Charles R Greathouse IV, Jul 24 2012
is(n)=while(n,if(n%3>1,return(0));n\=3);1 \\ Charles R Greathouse IV, Mar 07 2013
a(n) = fromdigits(binary(n-1),3); \\ Gheorghe Coserea, Jun 15 2018
def A005836(n): return int(format(n-1,'b'),3) # Chai Wah Wu, Jan 04 2015
After terms 0, 1, 3, 4 have been added, the terms 5,...,9 are forbidden by subsequences (3,4,5), (0,3,6), (1,4,7), (0,4,8) and (1,3,9) so the next term is 10.
# Program that generates all values of a(x) less than a given input n. def a(n): seq=[0, 1] for x in range(2, n+1): c=0 for y in seq: if (x+y)/2 not in seq: if (x*y)**0.5 not in seq[1:]: if (2*x*y)/(x+y) not in seq[1:]: c+=1 if c==len(seq): seq.append(x) return seq
After terms 0, 1, 3, 4 have been added, the terms 5,...,9 are forbidden by subsequences (3,4,5), (0,3,6), (1,4,7), (0,4,8) and (1,3,9) so the next term is 10.
seq = {0, 1}; bad[n_] := Catch[ Do[If[MemberQ[seq, (n + e)/2], Throw@True], {e, seq}]; Do[If[MemberQ[seq, Sqrt[n*e]], Throw@True], {e, Rest@ seq}]; False]; While[Length[seq] < 100, x = Last[seq]+1; While[bad[x], x++]; AppendTo[seq, x]]; seq
5 is in the sequence because 1,2,5 is neither an arithmetic progression nor a geometric progression.
{my(a=[1,2]); for(x=3,100, if(#select(r->#select(q->q==2*r,b)==0,b=vecsort(apply(r->x-r,a)))==#a && #select(r->#select(q->q==r^2,b)==0,b=vecsort(apply(r->x/r,a)))==#a,a=concat(a,x)));a }
first(n)=my(v=vector(n)); v[1]=1; for(k=2,n, my(avoid=List(),t,last=v[k-1]); for(i=2,k-1, for(j=1,i-1, t=2*v[i]-v[j]; if(t>last, listput(avoid, t)); if(denominator(t=v[i]^2/v[j])==1 && t>last, listput(avoid,t)))); avoid=Set(avoid); for(i=v[k-1]+1,v[k-1]+#avoid+1, if(!setsearch(avoid,i), v[k]=i; break))); v \\ Charles R Greathouse IV, Jun 29 2017
6 is not a term in the sequence because it would form a harmonic progression with 2 and 3, which occurred earlier. The progression (1/6, 1/3, 1/2) has common difference 1/6.
from itertools import count def A381137_generator(): a_list = [] forbidden = set() a = 0 while 1: a = next(k for k in count(a+1) if k not in forbidden) yield a forbidden.update(a*b//m for b in a_list if (m:=2*b-a) > 0 and a*b%m == 0) a_list.append(a) # Pontus von Brömssen, Mar 04 2025
Comments